Non Deterministic Automata

Slides:



Advertisements
Similar presentations
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Advertisements

1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Lecture 6 Nondeterministic Finite Automata (NFA)
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
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.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
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.
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.
1 Finite Automata. 2 Finite Automaton Input “Accept” or “Reject” String Finite Automaton Output.
1 Languages and Finite Automata or how to talk to machines...
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.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
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.
1 Non-Deterministic Automata Regular Expressions.
Finite Automata Costas Busch - RPI.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
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.
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.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Theory of Computation Automata Theory Dr. Ayman Srour.
1 Finite Automata. 2 Introductory Example An automaton that accepts all legal Pascal identifiers: Letter Digit Letter or Digit "yes" "no" 2.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Theory of Computation Automata Theory Dr. Ayman Srour.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
CIS Automata and Formal Languages – Pei Wang
Languages.
Non Deterministic Automata
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Pushdown Automata PDAs
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
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
CSE322 Definition and description of finite Automata
Nondeterministic Finite Automata
NFAs and Transition Graphs
Finite Automata.
CSCI 2670 Introduction to Theory of Computing
Chapter 1 Regular Language
NFAs and Transition Graphs
NFAs accept the Regular Languages
Non Deterministic Automata
Presentation transcript:

Non Deterministic Automata

Nondeterministic Finite Accepter (NFA) Alphabet =

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices No transition No transition

First Choice

First Choice

First Choice

First Choice All input is consumed “accept”

Second Choice

Second Choice

Second Choice No transition: the automaton hangs

Second Choice Input cannot be consumed “reject”

An NFA accepts a string: when there is a computation of the NFA that accepts the string All the input is consumed and the automaton is in a final state

Example is accepted by the NFA: “accept” “reject” because this computation accepts

Rejection example

First Choice

First Choice “reject”

Second Choice

Second Choice

Second Choice “reject”

An NFA rejects a string: when there is no computation of the NFA that accepts the string All the input is consumed and the automaton is in a non final state The input cannot be consumed

Example is rejected by the NFA: “reject” “reject” All possible computations lead to rejection

Rejection example

First Choice

First Choice No transition: the automaton hangs

First Choice Input cannot be consumed “reject”

Second Choice

Second Choice

Second Choice No transition: the automaton hangs

Second Choice Input cannot be consumed “reject”

is rejected by the NFA: “reject” “reject” All possible computations lead to rejection

Language accepted:

Lambda Transitions

(read head doesn’t move)

all input is consumed “accept” String is accepted

Rejection Example

(read head doesn’t move)

No transition: the automaton hangs

Input cannot be consumed “reject” String is rejected

Language accepted:

Another NFA Example

“accept”

Another String

“accept”

Language accepted

Another NFA Example

Language accepted

Remarks: The symbol never appears on the input tape Extreme automata:

NFAs are interesting because we can express languages easier than DFAs NFA DFA

Formal Definition of NFAs Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Final states

Transition Function

Extended Transition Function

Formally It holds if and only if there is a walk from to with label

The Language of an NFA

Formally The language accepted by NFA is: where and there is some (final state)

Equivalence of NFAs and DFAs

Equivalence of Machines For DFAs or NFAs: Machine is equivalent to machine if

Example NFA DFA

Since machines and are equivalent NFA DFA

Equivalence of NFAs and DFAs Question: NFAs = DFAs ? Same power? Accept the same languages?

Equivalence of NFAs and DFAs Question: NFAs = DFAs ? YES! Same power? Accept the same languages?

We will prove: Languages accepted by NFAs Languages accepted by DFAs NFAs and DFAs have the same computation power

Step 1 Languages accepted by NFAs Languages accepted by DFAs Proof: Every DFA is trivially an NFA A language accepted by a DFA is also accepted by an NFA

Step 2 Languages accepted by NFAs Languages accepted by DFAs Proof: Any NFA can be converted to an equivalent DFA A language accepted by an NFA is also accepted by a DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA NFA DFA

NFA to DFA: Remarks We are given an NFA We want to convert it to an equivalent DFA With

If the NFA has states the DFA has states in the powerset

Procedure NFA to DFA 1. Initial state of NFA: Initial state of DFA:

Example NFA DFA

Procedure NFA to DFA 2. For every DFA’s state Compute in the NFA Add transition to DFA

Exampe NFA DFA

Procedure NFA to DFA Repeat Step 2 for all letters in alphabet, until no more transitions can be added.

Example NFA DFA

Procedure NFA to DFA 3. For any DFA state If some is a final state in the NFA Then, is a final state in the DFA

Example NFA DFA

Theorem Take NFA Apply procedure to obtain DFA Then and are equivalent :

Finally We have proven Languages accepted by NFAs Languages accepted by DFAs

We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages

We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages Regular Languages

We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages Regular Languages Thus, NFAs accept the regular languages