Non-Deterministic Finite Automata

Similar documents
Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Deterministic Finite Automata

Chapter 2 Finite Automata

input tape head moves current state

Worked out examples Finite Automata

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CS375: Logic and Theory of Computing

Designing finite automata II

Non-deterministic Finite Automata

CHAPTER 1 Regular Languages. Contents

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Lecture 6 Regular Grammars

Let's start with an example:

Deterministic Finite-State Automata

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Some Theory of Computation Exercises Week 1

Regular expressions, Finite Automata, transition graphs are all the same!!

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Formal Languages and Automata

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Formal Language and Automata Theory (CS21004)

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Recursively Enumerable and Recursive. Languages

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

1 Nondeterministic Finite Automata

Lecture 08: Feb. 08, 2019

Nondeterminism and Nodeterministic Automata

Java II Finite Automata I

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Automata and Languages

Finite-State Automata: Recap

Non-deterministic Finite Automata

More on automata. Michael George. March 24 April 7, 2014

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Hybrid Control and Switched Systems. Lecture #2 How to describe a hybrid system? Formal models for hybrid system

Fundamentals of Computer Science

Convert the NFA into DFA

Normal Forms for Context-free Grammars

a b b a pop push read unread

CS 275 Automata and Formal Language Theory

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CISC 4090 Theory of Computation

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Lexical Analysis Finite Automate

Minimal DFA. minimal DFA for L starting from any other

1.4 Nonregular Languages

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Turing Machines Part One

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CMSC 330: Organization of Programming Languages

In-depth introduction to main models, concepts of theory of computation:

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Lecture 9: LTL and Büchi Automata

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Agenda. Agenda. Regular Expressions. Examples of Regular Expressions. Regular Expressions (crash course) Computational Linguistics 1

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

Introduction to ω-autamata

State Minimization for DFAs

Thoery of Automata CS402

This lecture covers Chapter 8 of HMU: Properties of CFLs

Formal Methods in Software Engineering

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

FABER Formal Languages, Automata and Models of Computation

Finite Automata-cont d

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Context-Free Grammars and Languages

1.3 Regular Expressions

Harvard University Computer Science 121 Midterm October 23, 2012

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

Finite Automata Part Three

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Nondeterministic Biautomata and Their Descriptional Complexity

Lecture 09: Myhill-Nerode Theorem

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

NFAs continued, Closure Properties of Regular Languages

Relating logic to formal languages

Model Reduction of Finite State Machines by Contraction

How to simulate Turing machines by invertible one-dimensional cellular automata

Transcription:

Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1

Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2

Alphbet ={} Two choices q1 q2 3

Alphbet ={} Two choices q1 q2 No trnsition No trnsition 4

First Choice q1 q2 5

First Choice q1 q2 6

First Choice q1 q2 7

First Choice All input is consumed q1 q2 ccept 8

Second Choice q1 q2 9

Second Choice q1 q2 10

Second Choice q1 q2 No trnsition: the utomton hngs 11

Second Choice Input cnnot be consumed q1 q2 reject 12

An NFA ccepts string: when there is computtion of the NFA tht ccepts the string There is computtion: ll the input is consumed nd the utomton is in n ccepting stte 13

Exmple is ccepted by the NFA: ccept q 1 q2 q 1 q2 becuse this computtion ccepts reject 14

Rejection exmple q1 q2 15

First Choice q1 q2 16

First Choice reject q1 q2 17

Second Choice q1 q2 18

Second Choice q1 q2 19

Second Choice q1 q2 reject 20

An NFA rejects string: when there is no computtion of the NFA tht ccepts the string. For ech computtion: All the input is consumed nd the utomton is in non finl stte OR The input cnnot be consumed 21

Exmple is rejected by the NFA: q 1 q2 reject q 1 q2 reject All possible computtions led to rejection 22

Rejection exmple q1 q2 23

First Choice q1 q2 24

First Choice q1 q2 No trnsition: the utomton hngs 25

First Choice Input cnnot be consumed q1 q2 reject 26

Second Choice q1 q2 27

Second Choice q1 q2 28

Second Choice q1 q2 No trnsition: the utomton hngs 29

Second Choice Input cnnot be consumed q1 q2 reject 30

is rejected by the NFA: reject q 1 q2 q 1 q2 reject All possible computtions led to rejection 31

Lnguge ccepted: L {} q1 q2 32

Lmbd Trnsitions q q3 q0 1 q2 33

q q3 q0 1 q2 34

q q3 q0 1 q2 35

(red hed does not move) q q3 q0 1 q2 36

q q3 q0 1 q2 37

ll input is consumed q q3 q0 1 q2 ccept String is ccepted 38

Rejection Exmple q q3 q0 1 q2 39

q q3 q0 1 q2 40

(red hed doesn t move) q q3 q0 1 q2 41

q q3 q0 1 q2 No trnsition: the utomton hngs 42

Input cnnot be consumed reject q q3 q0 1 q2 String is rejected 43

Lnguge ccepted: L {} q q3 q0 1 q2 44

Another NFA Exmple b q3 q0 1 q q2 45

b b q3 q0 1 q q2 46

b q b q2 q3 0 q 1 47

b q q b 1 q3 0 q 2 48

b q q b 1 q3 0 ccept q 2 49

Another String b b q b 0 q1 2 q q3 50

b b q b 0 q1 2 q q3 51

b b q b 0 q1 2 q q3 52

b b q b 0 q1 2 q q3 53

b b q b 0 q1 2 q q3 54

b b q b 0 q1 2 q q3 55

b b q b 0 q1 2 q q3 56

b b q b 0 ccept q1 2 q q3 57

Lnguge ccepted L b, bb, bbb,... b b q3 q0 1 q q2 58

Another NFA Exmple 0 q0 1 1,1 q2 59

Lnguge ccepted L(M ) = = { } λ, 10, { 10}* 1010, 101010,... 0 q0 1 1,1 q2 (redundnt stte) 60

Remrks: The symbol never ppers on the input tpe Simple utomt: M 1 M 2 L(M 1 ) = {} (M ) = {λ} L 2 61

NFAs re interesting becuse we cn express lnguges esier thn FAs NFA M 1 FA M 2 q 0 q1 q 2 q 1 L( M1) = { } L( M 2) = { } 62

Forml Definition of NFAs M Q,,, q0, F Q : Set of sttes, i.e. q0, q1, q 2 : Input plhbet, i.e., b : Trnsition function : Initil stte F : Accepting sttes 63

Trnsition Function q, q 0 1 1 0 q0 1 1,1 q2 64

( q1,0) { q0, q 2 } 0 1,1 1 q2 65

( q0, ) { q0, q 2 } 0 1,1 1 q2 66

( q 2,1) 0 1,1 1 q2 67

Extended Trnsition Function * * q q 0, 1 q 4 q 5 q 1 b q 2 68

* q q q 0, 4, 5 q 4 q 5 q 1 b q 2 69

* q q q q 0, b 2, 3, 0 q 4 q 5 q 1 b q 2 70

q j i, Formlly * q w : there is wlk from to with lbel w qi q j qi w q j w 1 2 k qi 1 2 k q j 71

The Lnguge of n NFA M F,q 5 q 4 q 5 q 1 b q 2 * q q q 0, 4, 5 L(M ) F 72

F,q 5 q 4 q 5 q 1 b q 2 * q q q q 0, b 2, 3, 0 F b L M 73

F,q 5 q 4 q 5 q 1 b q 2 * q q q 0, b 4, 5 F b L(M ) 74

F,q 5 q 4 q 5 q 1 b q 2 * q b q 0, 1 b L M F 75

q 4 q 5 q 1 b q 2 L M b * { } 76

Formlly The lnguge ccepted by NFA M is: L M w1, w2, w3,... where *(, w ) { q, q,..., q, } m i j k nd there is some q k F (ccepting stte) 77

w L M *(, w) w q i q0 w qk q k F w q j 78