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

Similar documents
Non-Deterministic Finite Automata

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

input tape head moves current state

Chapter 2 Finite Automata

CS375: Logic and Theory of Computing

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

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

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

Deterministic Finite Automata

Non-deterministic Finite Automata

Lecture 6 Regular Grammars

Formal Language and Automata Theory (CS21004)

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

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

CS 275 Automata and Formal Language Theory

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

CHAPTER 1 Regular Languages. Contents

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

Designing finite automata II

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

Deterministic Finite-State Automata

Worked out examples Finite Automata

Let's start with an example:

Lecture 08: Feb. 08, 2019

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

Formal Languages and Automata

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Some Theory of Computation Exercises Week 1

Nondeterminism and Nodeterministic Automata

Recursively Enumerable and Recursive. Languages

Non-deterministic Finite Automata

1 Nondeterministic Finite Automata

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

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

Automata and Languages

Fundamentals of Computer Science

Convert the NFA into DFA

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

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

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

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

Java II Finite Automata I

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

Introduction to ω-autamata

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

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

Turing Machines Part One

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

a b b a pop push read unread

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

Finite-State Automata: Recap

CMSC 330: Organization of Programming Languages

1.4 Nonregular Languages

Minimal DFA. minimal DFA for L starting from any other

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CISC 4090 Theory of Computation

Normal Forms for Context-free Grammars

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.

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

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

CSCI FOUNDATIONS OF COMPUTER SCIENCE

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

Harvard University Computer Science 121 Midterm October 23, 2012

Formal languages, automata, and theory of computation

Lexical Analysis Finite Automate

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

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

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

Finite Automata Part Three

NFAs continued, Closure Properties of Regular Languages

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

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

Finite Automata-cont d

Lecture 09: Myhill-Nerode Theorem

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

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

This lecture covers Chapter 8 of HMU: Properties of CFLs

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

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

1.3 Regular Expressions

State Minimization for DFAs

FABER Formal Languages, Automata and Models of Computation

Languages & Automata

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

7 Automata and formal languages. 7.1 Formal languages

Today s Topics Automata and Languages

Automata and Languages

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Turing Machines Part One

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

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

CSC 311 Theory of Computation

Formal Methods in Software Engineering

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

Transcription:

Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1

Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges nd Automt - Yonsei CS 2

Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices q 1 q2 No trnsition No trnsition Forml Lnguges nd Automt - Yonsei CS 3

First Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 4

First Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 5

First Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 6

First Choice All input is consumed q 1 q2 ccept Forml Lnguges nd Automt - Yonsei CS 7

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 8

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 9

Second Choice q 1 q2 No trnsition: the utomton hngs Forml Lnguges nd Automt - Yonsei CS 10

Second Choice Input cnnot be consumed q 1 q2 reject Forml Lnguges nd Automt - Yonsei CS 11

An NFA ccepts string: when there is computtion of the NFA tht ccepts the string AND ll the input is consumed nd the utomton is in finl stte Forml Lnguges nd Automt - Yonsei CS 12

Exmple is ccepted by the NFA: ccept q 1 q2 q 1 q2 becuse this computtion ccepts Forml Lnguges nd Automt - Yonsei CS 13 reject

Rejection exmple q 1 q2 Forml Lnguges nd Automt - Yonsei CS 14

First Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 15

First Choice reject q 1 q2 Forml Lnguges nd Automt - Yonsei CS 16

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 17

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 18

Second Choice q 1 q2 reject Forml Lnguges nd Automt - Yonsei CS 19

An NFA rejects string: when there is no computtion of the NFA tht ccepts the string: All the input is consumed nd the utomton is in non finl stte OR The input cnnot be consumed Forml Lnguges nd Automt - Yonsei CS 20

Exmple is rejected by the NFA: q 1 q2 reject q 1 q2 reject All possible computtions led to rejection Forml Lnguges nd Automt - Yonsei CS 21

Rejection exmple q 1 q2 Forml Lnguges nd Automt - Yonsei CS 22

First Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 23

First Choice q 1 q2 No trnsition: the utomton hngs Forml Lnguges nd Automt - Yonsei CS 24

First Choice Input cnnot be consumed q 1 q2 reject Forml Lnguges nd Automt - Yonsei CS 25

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 26

Second Choice q 1 q2 Forml Lnguges nd Automt - Yonsei CS 27

Second Choice q 1 q2 No trnsition: the utomton hngs Forml Lnguges nd Automt - Yonsei CS 28

Second Choice Input cnnot be consumed q 1 q2 reject Forml Lnguges nd Automt - Yonsei CS 29

is rejected by the NFA: reject q 1 q2 q 1 q2 reject All possible computtions led to rejection Forml Lnguges nd Automt - Yonsei CS 30

Lnguge ccepted: L = {} q 1 q2 Forml Lnguges nd Automt - Yonsei CS 31

Lmbd Trnsitions nf cn mke trnsition without consuming n input symbol q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 32

q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 33

(red hed does not move) q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 34

q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 35

ll input is consumed q0 q 1 q2 ccept String is ccepted Forml Lnguges nd Automt - Yonsei CS 36

Rejection Exmple q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 37

q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 38

(red hed doesn t move) q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 39

q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 40 No trnsition: the utomton hngs

Input cnnot be consumed q0 q 1 q2 reject String is rejected Forml Lnguges nd Automt - Yonsei CS 41

Lnguge ccepted: L = {} q0 q 1 q2 Forml Lnguges nd Automt - Yonsei CS 42

Another NFA Exmple b q b q 2 q0 1 Forml Lnguges nd Automt - Yonsei CS 43

b q b q 2 0 q 1 Forml Lnguges nd Automt - Yonsei CS 44

b q q b 1 0 q 2 Forml Lnguges nd Automt - Yonsei CS 45

b q q b 1 0 ccept q 2 Forml Lnguges nd Automt - Yonsei CS 46

Another String b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 47

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 48

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 49

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 50

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 51

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 52

b b q b q q3 0 q1 2 Forml Lnguges nd Automt - Yonsei CS 53

b b q b q q3 0 ccept q1 2 Forml Lnguges nd Automt - Yonsei CS 54

L = Lnguge ccepted { b, bb, bbb,...} = { b} + q b q 2 q0 1 Forml Lnguges nd Automt - Yonsei CS 55

Another NFA Exmple 0 q0 1 1,1 q2 Forml Lnguges nd Automt - Yonsei CS 56

Lnguge ccepted L(M ) = = { }, 10, { 10}* 1010, 101010,... 0 q0 1 1,1 q2 (redundnt stte) Forml Lnguges nd Automt - Yonsei CS 57

Remrks: The symbol never ppers on the input tpe Simple utomt: M 1 M 2 L(M 1 ) = {} (M ) = {} L 2 Forml Lnguges nd Automt - Yonsei CS 58

NFAs re interesting becuse we cn express lnguges esier thn DFAs NFA M 1 DFA M 2 q 0 q1 q 2 q 1 L( M1) = { } L( M 2) = { } Forml Lnguges nd Automt - Yonsei CS 59

Forml Definition of NFAs ( Q q F ) M =, Σ, δ, 0, Q : Set of sttes, i.e. { q, q q } 0 1, 2 Σ Input lphbet, i.e. {, b} : δ : Trnsition function : Initil stte F : Finl sttes Forml Lnguges nd Automt - Yonsei CS 60

Trnsition Function δ δ ( q, ) = { q } 0 1 1 0 q0 1 1,1 q2 Forml Lnguges nd Automt - Yonsei CS 61

δ ( q 1,0) = { q0, q 2 } 0 1,1 1 q2 Forml Lnguges nd Automt - Yonsei CS 62

δ (, ) = { q0, q 2 } 0 1,1 1 q2 Forml Lnguges nd Automt - Yonsei CS 63

δ ( q 2,1) = 0 1,1 1 q2 Forml Lnguges nd Automt - Yonsei CS 64

Extended Trnsition Function δ * δ ( q ) = { } * q 0, 1 q 4 q 5 q 1 b q 2 Forml Lnguges nd Automt - Yonsei CS 65

δ ( q ) = { } * q q 0, 4, 5 q 4 q 5 q 1 b q 2 Forml Lnguges nd Automt - Yonsei CS 66

δ ( q b) = { } * q q q 0, 2, 3, 0 q 4 q 5 q 1 b q 2 Forml Lnguges nd Automt - Yonsei CS 67

Formlly q ( q w) j δ * i, : there is wlk from qi to with lbel w q j qi w q j w = σ 1 σ 2 Lσ k qi σ1 σ 2 σ k q j Forml Lnguges nd Automt - Yonsei CS 68

The Lnguge of n NFA M F = { },q 5 q 4 q 5 q 1 b q 2 δ ( q ) = { } * q q 0, 4, 5 F L(M ) Forml Lnguges nd Automt - Yonsei CS 69

F = { },q 5 q 4 q 5 q 1 b q 2 ( q b) = { } δ * q q q b L( M ) 0, 2, 3, 0 F Forml Lnguges nd Automt - Yonsei CS 70

F = { },q 5 q 4 q 5 q 1 b q 2 δ ( q b) = { } * q q 0, 4, 5 F b L(M ) Forml Lnguges nd Automt - Yonsei CS 71

F = { },q 5 q 4 q 5 q 1 b q 2 δ *( q b) = { q } b L( M ) 0, 1 F Forml Lnguges nd Automt - Yonsei CS 72

q 4 q 5 q 1 b q 2 L ( M ) = { } { b} * { } Forml Lnguges nd Automt - Yonsei CS 73

Formlly The lnguge ccepted by NFA is: M ( M ) {,,...} L = w1 w w, 2 3 where δ *(, w ) = { q, q,..., q, K} m i j k nd there is some q k F (finl stte) Forml Lnguges nd Automt - Yonsei CS 74

w L( M ) δ *(, w) w q i q0 w qk q k F w q j Forml Lnguges nd Automt - Yonsei CS 75