Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.

Slides:



Advertisements
Similar presentations
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
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)
Deterministic Finite Automata (DFA)
Finite Automata CPSC 388 Ellen Walker Hiram College.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Bina Nusantara Finite Automata II (FA) Pertemuan 24: Mata kuliah:K0144/ Matematika Diskrit Tahun:2008.
CS21 Decidability and Tractability
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.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
Introduction to Computability Theory
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Finite Automata and Non Determinism
CS5371 Theory of Computation
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
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.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
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.
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.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
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.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Lecture Notes 
Recap: Transformation NFA  DFA  s s1s1... snsn p1p1 p2p2... pmpm >...  p1p1  p2p2  pipi s e s1s1 e s2s2 e sisi >
using Deterministic Finite Automata & Nondeterministic Finite Automata
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.
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
Deterministic Finite Automata Nondeterministic Finite Automata.
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.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Deterministic Finite Automata (DFAs). Reminder: Functions vs Relations Let P = {p: p is a person} M = {m: m is a male} S 1 = {(m,p): m is in M, p is in.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Non Deterministic Automata
Nondeterministic Finite Automata
Solution Prove by induction the following statement:
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non Deterministic Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
Presentation transcript:

Nondeterministic Finite Automata (NFAs)

Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only one transition of the following form occurs: q’  sp b a q > b a r b a t ba ab

Expressiveness of DFA DFA are a type of programs Contains concepts of imperative languages: sequences, branching and loops. Can implement a newspaper vendor machine or even control a character in a video game Can implement pattern matching: find all text containing “Britney Spears” Can only implement programs that require a constant amount of memory (or “Justin Timberlake”)

Another Example sq b a b a r a b q b a a r > sq a r a b q a b b r > What is the language recognized by A? A B What is the language recognized by B?

Nondeterministic Finite Automata s q b a r a b q b a a r > a q r b q’ b a b r’ a 1.Why is this automaton nondeterministic? 2.What is the language accepted by this automaton?

Nondeterministic Finite Automata (NFA) For every state q in S and every character  in , one of the following will happen: qq’  No transition: occurs One or more transitions:qq’  occurs p  …

Nondeterministic Finite Automaton (NFA) A nondeterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called states  is a finite input alphabet s  Q called the start state F  Q called the favorable states   Q × (   {e}) × Q The crucial point is that  is a relation Are  and  representing the same transitions? “the empty word” Book says: (Q, , ,s,F) where:  is a transition function, Q × (   {e}) ×  (Q) “power set”

Nondeterministic Finite Automata (NFA) What else can occur in NFAs? qq’ e If next word to process in q is aaabbb and apply this transition, what is the word to be processed in q’? aaabbb “e-transitions” do not process any characters, they just allow to “jump” between states

Formal Definition of Computation for NFAs Given a nodeterministic finite automaton N= (Q, , ,s,F), and let w = w 1 w 2 …w n, where each w i is in  M accepts w if we can write w as: w = y 1 y 2 …y m, where each y i is in (   {e}) and there is a sequence of states r 0 r 1, r 2 … r m in Q such that: 1.r 0 is the start state of M 2.r i+1   (r i, w i+1 ) for i = 0, …, m-1 3. r m  F Language recognized by N: {w in  * : N accepts w}

Same Example s q b a r a b q b a a r > a q r b q’ b a b r’ a Language accepted by this automaton is the set of all strings containing either the substring “aa” or the substring “bb”

Example sq r q b r > b a b 1.Why is this automation nondeterministic? 2.What is the language accepted by this automaton?

Why We Study Nondeterministic Computation? Makes it easier to prove properties about Automata –In particular, makes it easier to prove certain properties: If A is a regular language then A R is also regular It also makes it possible to understand the boundaries of computation –P = NP?

Oracle in NFAs The oracle explanation of NFAs: given a choice between possible transitions, there is a device, called the oracle, that always chooses the transition that leads to a favorable state Is the oracle explanation compatible with our definition of acceptability in NFAs? Sometimes it is useful to use the oracle when creating NFAs “current state”... … Oracle chooses this transition because it leads to a favorable state

NFA vs DFA Every DFA can be seen as an NFA But not every NFA can be seen as a DFA Are DFA’s more expressive? What does this means? For example, is there an DFA that accepts the same language accepted by the following NFA? It means that there an NFA can be constructed that accepts a language L for which no DFA can be constructed that accepts L sq r q b r > b a b

NFA vs DFA (2) How about this one? s q b a r a b q b a a r > a q r b q’ b a b r’ a It turns out that for every NFA, a DFA can be constructed such they both accept the same language. We will study a formal proof of this on Wednesday