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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2005.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
January 7, 2015CS21 Lecture 21 CS21 Decidability and Tractability Lecture 2 January 7, 2015.
Introduction to Computability Theory
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
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 Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Introduction to Computability Theory
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
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.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Athasit Surarerks THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Lecture Notes 
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
Theory of Computation Automata Theory Dr. Ayman Srour.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Non Deterministic Automata
Chapter 2 FINITE AUTOMATA.
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Hierarchy of languages
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
Finite Automata Reading: Chapter 2.
CSE 2001: Introduction to Theory of Computation Fall 2009
Discrete Math II Howon Kim
CS21 Decidability and Tractability
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
Nondeterminism The Chinese University of Hong Kong Fall 2010
Presentation transcript:

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 an equivalent DFA.

Nondeterminism Nondeterministic machines have option to make multiple moves from a state on an input. A nondeterministic finite automaton has transition rules/possibilities like q1q1 q2q2  q1q1 q2q2 1 q3q3 1

Why non-deterministic automata? Non-determinism is a fundamental computational concept. to model rules in games: in games, there is more than one choice in a given position. Grammars and rewriting systems are non-deterministic by nature. Non-deterministic finite automata are more compact. Modeling uncertainty in nature or unknown domains:

A Nondeterministic Automaton q1q1 q2q2 q3q3 1 0,  0,1 This automaton accepts “0110”, because there is a possible path that leads to an accepting state, namely: q 1  q 1  q 2  q 3  q 4  q 4 q4q4 1 0,1

A Nondeterministic Automaton q1q1 q2q2 q3q3 1 0,  0,1 The string 1 gets rejected: on “1” the automaton can only reach: {q 1,q 2,q 3 }. q4q4 1 0,1

A Nondeterministic Automaton Designing a NFA is sometimes easier. Example: L = { x | x contains 101 or 110 as a substring } Designing a DFA for this language is tricky, but NFA design is easy.

NFA – computation tree For any (sub)string w, the nondeterministic automaton can be in a set of possible states. If the final set contains an accepting state, then the automaton accepts the string. “The automaton processes the input in a parallel fashion. Its computational path is no longer a line, but a tree.”

Nondeterministic FA (definition) A nondeterministic finite automaton (NFA) M is defined by a 5-tuple M=(Q, , ,q 0,F), with –Q: finite set of states –  : finite alphabet –  : transition function  :Q    P (Q) –q 0  Q: start state –F  Q: set of accepting states

Nondeterministic  :Q    P (Q) The function  :Q    P (Q) is the crucial difference. It means: “ When reading symbol “a” while in state q, one can go to one of the states in  (q,a)  Q.” The  in   =   {  } provides null-transitions: moves in which a state transition occurs without reading the next input symbol.

Example NFA from the text

Non-deterministic Finite Automata (NFAs)   xample 2: Does this NFA accept 11011?  

              

Equivalence of NFAs and DFAs Obvious Fact: If L is a language accepted by a DFA then there is an NFA that also accepts it. This is because every DFA is an NFA. Theorem: If L is a language accepted by an NFA then there is a DFA that also accepts it. Proof is constructive. We describe an algorithm to convert an NFA to an equivalent DFA.

Proof idea: First consider an NFA M without  - moves. We are to design a DFA M’ that simulates it. Since NFA can be one of many states after reading an input, the simulating DFA will have as its states the subsets of states of M. p q r s {p} {q, r, s} a a a a  r, x, m, p} Will be an accepting state so long as at least one of the states is an accepting state in the original NFA.

Converting an  -free NFA to a DFA: Let M = (Q, , ,q 0,F) be an NFA. The equivalent DFA is M’ = ( P (Q), ,  ’, {q 0 }, F’) where  ’ (A, a) = all states reachable from some state in A on input a. (If A = { q 1, …, q m } then,  ’ (A, a) =  (q 1, a) U  (q 2, a) U … U  (q m, a) ) F’ = { A | A F } We can show that L(M) = L(M’).

Conversion of an NFA to a DFA c b 1 1, NFA a Equivalent DFA {a}{b}{c} {a,b}{a,c}{b,c} {a,b,c} ,  xample 1:

Dealing with e-moves  -closure: For a set of states R,  -closure(R) is defined as the set of states reachable from states in R by a sequence of  -moves     f R = {1, 3}, what is  -closure(R)? 

Converting an NFA M with  -moves to a DFA: Suppose we have computed  -closure of every state in M. To accept a string a 1 … a m, M can first perform a sequence of  -moves, then move on a 1, then perform a sequence of  -moves, then move on a 2, etc. Finally, after a move on a m, it can perform another sequence of  - moves and reach an accepting state. Recall the subset construction we described above to convert an  -free NFA to a DFA. What changes do we need to make it work for NFA with  -moves?

Example: 