NFAs and DFAs Sipser 1.2 (pages 47-63).

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure.
0 - 0.
Addition Facts
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
Measuring Time Complexity
Non-Deterministic Finite Automata
Addition 1’s to 20.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Week 1.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof Latex files on ella.
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.
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Mount Holyoke College 2 Building languages If L is a language, then its complement is L’ = {w |
NFAs and DFAs Sipser 1.2 (pages 47-63). Last time…
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
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.
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
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.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Fall 2006Costas Busch - RPI1 Properties of 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.
Regular expressions Sipser 1.3 (pages 63-76). CS 311 Fall Looks familiar…
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
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 Closure Properties Sipser pages pages NFAs also have closure properties We have given constructions for showing that DFAs are closed under.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
CHAPTER 1 Regular Languages
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Regular Expressions Costas Busch - LSU.
Nondeterministic Finite Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
CSE 2001: Introduction to Theory of Computation Fall 2009
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CS21 Decidability and Tractability
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Presentation transcript:

NFAs and DFAs Sipser 1.2 (pages 47-63)

Last time…

NFA A nondeterministic finite automaton (NFA) is a 5-tuple (Q, Σ, δ, q0, F), where Q is a finite set called the states Σ is a finite set called the alphabet δ: Q × Σε → P(Q) is the transition function q0∈Q is the start state F⊆Q is a set of accept states In-class exercise:

NFA computation Let N=(Q, Σ, δ, q0, F) be a NFA and let w be a string over the alphabet Σ Then N accepts w if w can be written as w1w2w3…wm with each wi∈Σε and There exists a sequence of states s0,s1,s2,…,sm exists in Q with the following conditions: s0=q0 si+1∈δ(si,wi+1) for i = 0,…,m-1 sn∈F

One last operation

Kleene star operation Let A be a language. The Kleene star operation is A* = {x1x2…xk | k ≥ 0 and each xi ∈ A} Exercise A = {w | w is a string of 0s and 1s containing an odd number of 1s} B = {w | w is a string of 0s and 1s containing an even number of 1s} C = {0,1} What are A*, B*, and C*?

- From http://visualbasic.about.com/od/usevb6/a/RegExVB6.htm Clay Knee? Kleene pronounced his last name klay'nee. His son, Ken Kleene, wrote: "As far as I am aware this pronunciation is incorrect in all known languages. I believe that this novel pronunciation was invented by my father." Dr. "Clay Knee" must have been a geek of the first water, to be sure! - From http://visualbasic.about.com/od/usevb6/a/RegExVB6.htm

Kleene star Theorem: The class of languages recognized by NFAs is closed under the Kleene star operation.

If only… … somebody would prove that the class of languages recognized by NFAs and the class of languages recognized by DFAs were equal…

Then… We’d have: The class of regular languages is closed under: Concatenation Kleene star

a cute proof for closure under union! And… a cute proof for closure under union!

We can be that somebody! Theorem: A language is regular if and only if there exists an NFA that recognizes it. Proof: (⇒) Let A be a regular language…

Then there exists a DFA M M is a 5-tuple (Q, Σ, δM, q0, F), where Q is a finite set called the states Σ is a finite set called the alphabet δ: Q × Σ → Q is the transition function q0∈Q is the start state F⊆Q is a set of accept states

We need to show there exists an NFA N N is a 5-tuple (Q, Σ, δN, q0, F), where Q is a finite set called the states Σ is a finite set called the alphabet δ: Q × Σε → P(Q) is the transition function q0∈Q is the start state F⊆Q is a set of accept states Can we define N from M?

Now the other way! Theorem: A language is regular if and only if there exists an NFA that recognizes it. Proof: (⇒) Let A be a language accepted by NFA N = (Q, Σ, δ, q0, F)

Equivalent machines Definition: Two machines are equivalent if they recognize the same language Let’s prove: Theorem: Every NFA has an equivalent DFA.

Remember…

A simpler example

Removing choice Proof: Let A be a language accepted by NFA N = (Q, Σ, δ, q0, F) We construct a DFA M=(Q’, Σ, δ’, q0’, F’) recognizing A Q’ = P(Q) For R∈Q' and a∈Σ, define δ'(R,a) = ∪ δ(r,a) q0’ = {q0} F’ = { R∈Q’ | R contains an accept state from F} r∈R

Okay, but what about ε arrows?

Modifying our construction Proof: Let A be a language accepted by NFA N = (Q, Σ, δ, q0, F) We construct a DFA M=(Q’, Σ, δ’, q0’, F’) recognizing A Q’ = P(Q) For R∈Q' and a∈Σ, define δ'(R,a) = ∪ E(δ(r,a)) where E(R) = {q | q can be reached from R along 0 or more ε arrows} q0’ = E({q0}) F’ = { R∈Q’ | R contains an accept state from F} r∈R