Nondeterministic Finite Automata

Slides:



Advertisements
Similar presentations
Non-Deterministic Finite Automata
Advertisements

CSE 311 Foundations of Computing I
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.
Lecture 6 Nondeterministic Finite Automata (NFA)
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
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)
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.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
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
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
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.
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 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)
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.
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.
Athasit Surarerks THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1.
Transition Diagrams Lecture 3 Wed, Jan 21, Building Transition Diagrams from Regular Expressions A regular expression consists of symbols a, b,
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Finite Automata – Definition and Examples Lecture 6 Section 1.1 Mon, Sep 3, 2007.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
The decidability of Presburger Arithmetic By Guillermo Guillen 04/13/05 Dr. Smith COT 6421 FIU Spring 2005.
Modeling Computation: Finite State Machines without Output
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
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.
Formal Language & Automata Theory
CIS Automata and Formal Languages – Pei Wang
L1= { w  {a,b}* : w consists of all strings that begin with an even number of a's followed by an odd number of b's. } L2= { w  {a,b}* : the number of.
Non Deterministic Automata
Theory of Computation Lecture # 9-10.
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Finite Automata & Regular Languages
An Introduction to Finite Automata
Chapter 2 FINITE AUTOMATA.
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Determinism 12CS45 Finite Automata.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Non Deterministic Automata
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.
Finite Automata.
CSCI 2670 Introduction to Theory of Computing
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
CSCI 2670 Introduction to Theory of Computing
Non Deterministic Automata
Nondeterminism The Chinese University of Hong Kong Fall 2010
Part Two : Nondeterministic Finite Automata
Presentation transcript:

Nondeterministic Finite Automata Section 2.2 Wed, Sep 22, 2004

A Tricky DFA Consider a DFA A1 that accepts any string containing 010. Consider a second DFA A2 that accepts any string containing 101. How would we design a DFA that accepts any string containing both 010 and 101? The occurrences might be separate (…010…101…) or combined (…0101…).

Nondeterminism Nondeterminism means that the next move is not uniquely determined by the current state and the current input symbol. In some cases, there is more than one possible transition to follow. The automaton will follow the “right” one, i.e., the one that leads to acceptance, if there is one.

A Nondeterministic Solution to the Tricky Automaton By using nondeterminism, we may set up transitions from the initial state on ‘0’ if it is the beginning of 010, but not 0101. ‘0’ if it is the beginning of 0101. ‘1’ if it is the beginning of 101, but not 1010. ‘1’ if it is the beginning of 1010. Otherwise, eat symbols.

A Nondeterministic Solution to the Tricky Automaton 1 0, 1

Nondeterministic Finite Automata A nondeterministic finite automaton (NFA) is a quintuple (K, , , s, F) where K is a finite set of states.  is a finite input alphabet. s  K is the initial state. F  K is the set of final states.  is the transition relation from K  (  {e}) to K.

DFA vs. NFA The difference between a DFA and an NFA is that the function  has been replaced by the relation . This allows Transitions such as (p, a, q1) and (p, a, q2) together, where q1 q2. Transitions such as (p, e, q), called “e-moves”. Without reading a symbol, i.e., “reading” e, move from p to q.

Acceptance by an NFA An NFA accepts a string w if there exists a sequence of transitions from the initial state to a final state that processes w. Note that there may also exist sequences that lead to non-final states. The language of the NFA is the set of all strings that it accepts.

Examples of NFAs Design an NFA that accepts all strings containing 001100. Design an NFA that accepts the strings 32, 33, …, 99, 100, …, 758. Design an NFA that accepts all strings that either contain 010 or do not contain 0.

Example: A DFA A DFA that accepts all strings that contain 010 or do not contain 0. 1 0, 1

Converting a Relation into a Function It is possible to rewrite a relation R from A to B as a function f from 2A to 2B. Define a function f : 2A  2B as follows: Given S  2A, define f(S) = {b  B | (a, b)  R for some a  S}. In other words, f maps each subset S of A to everything in B that is related to some element in S.

Example: Converting a Relation into a Function Let A = {2, 3, 4, 5} and B = {6, 7, 8, 9}. Define the relation R from A to B as (a, b)  R if “a divides b.” Then R = {(2, 6), (2, 8), (3, 6), (3, 9), (4, 8)}.

Example of Converting a Relation to a Function The function f : 2A  2B is f() =  f({2}) = {6, 8} f({3}) = {6, 9} f({4}) = {8} f({5}) =  f({2, 3}) = f({2, 3, 4, 5}) = {6, 8, 9} f({2, 4}) = f({2, 4, 5}) = {6, 8} f({2, 5}) = {6, 8} f({3, 4}) = f({2, 3, 4, 5}) = {6, 8, 9}

Example of Converting a Relation to a Function

Examples of Converting an NFA to a DFA Use this idea to rewrite the relation  of the NFA for all strings that contain 001100 as the function  of an equivalent DFA.

Equivalence of NFAs and DFAs Theorem: For each NFA M there exists a DFA M' that is equivalent to M. Outline of the proof: Convert the relation  to the function . Then form the “e-closure” of this set. Let q be any state in M. Define the e-closure of q to be all the states reachable from q by using only e-moves. E(q) = {p  K | (q, e) M* (p, e)}.

Proof, continued Define '(S) = E((S)). Define F' = {S  2K | S contains a final state}.  Verify that (2K, Σ, δ', E(s), F'}) is a DFA that accepts the same language as M.

Converting an NFA to a DFA Convert the following NFA to an equivalent DFA. 1 e

Examples of Converting an NFA to a DFA Design an NFA and a DFA for all strings that contain either 101 or 010. Redesign the NFA for all strings that either contain 101 or do not contain 0 as a DFA. Redesign the NFA that accepts the strings 32, 33, …, 99, 100, 101, …, 758 as a DFA.