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
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
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.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
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.
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.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
REGULAR LANGUAGES.
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.
Regular Expressions Costas Busch - LSU.
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.
Lecture #5 Advanced Computation Theory Finite Automata.
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.
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.
Pushdown Automata PDAs
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
Non Deterministic Automata
Finite Automata.
CSCI 2670 Introduction to Theory of Computing
Language Recognition (12.4)
Chapter 1 Regular Language
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”

AND An NFA accepts a string: when there is a computation of the NFA that accepts the string AND 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”

OR 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 OR 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 does not 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 (redundant state)

Remarks: The symbol never appears on the input tape Simple 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 : 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)

NFAs accept the Regular Languages

Equivalence of Machines Definition for Automata: Machine is equivalent to machine if

Example of equivalent machines NFA DFA

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

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

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

Convert NFA to DFA NFA DFA

Convert NFA to DFA NFA DFA

Convert NFA to DFA NFA DFA

Convert NFA to DFA NFA DFA

Convert NFA to DFA NFA DFA

Convert NFA to DFA NFA DFA

Convert 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 :

Proof AND

First we show: Take arbitrary: We will prove:

We will show that if

More generally, we will show that if in : (arbitrary string)

Proof by induction on Induction Basis:

Induction hypothesis:

Induction Step:

Induction Step:

Therefore if

We have shown: We also need to show: (proof is similar)