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

Slides:



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

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)
January 7, 2015CS21 Lecture 21 CS21 Decidability and Tractability Lecture 2 January 7, 2015.
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 |
Regular expressions Regular languages Sipser 1.3 (pages 63-76)
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Mount Holyoke College 2 Nonregular languages? We now know: –Regular languages may be specified either.
Regular expressions Sipser 1.3 (pages 63-76). CS 311 Mount Holyoke College 2 Looks familiar…
CFG => PDA Sipser 2 (pages ).
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.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
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.
CS 310 – Fall 2006 Pacific University CS310 Regular Expressions Sections:1.3 page 63 September 18, 2006 September 20, 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.
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)
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 13, 2006.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
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.
Athasit Surarerks THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
CHAPTER 1 Regular Languages
Finite Automata.
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.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Foundations of Computing Science
Properties of Regular Languages
Nondeterministic Finite Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
CSE 2001: Introduction to Theory of Computation Fall 2009
CS21 Decidability and Tractability
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

NFAs and DFAs Sipser 1.2 (pages 47-63)

Last time…

CS 311 Mount Holyoke College 3 NFA A nondeterministic finite automaton (NFA) is a 5-tuple (Q, Σ, δ, q 0, F), where – Q is a finite set called the states – Σ is a finite set called the alphabet – δ: Q × Σε → P(Q) is the transition function – q 0 ∈ Q is the start state – F ⊆ Q is a set of accept states In-class exercise:

CS 311 Mount Holyoke College 4 NFA computation Let N=(Q, Σ, δ, q 0, F) be a NFA and let w be a string over the alphabet Σ Then N accepts w if – w can be written as w 1 w 2 w 3 …w m with each w i ∈ Σε and –There exists a sequence of states s 0,s 1,s 2,…,s m exists in Q with the following conditions: 1.s 0 =q 0 2.s i+1 ∈ δ(s i,w i+1 ) for i = 0,…,m-1 3.s n ∈ F

One last operation

CS 311 Mount Holyoke College 6 Kleene star operation Let A be a language. The Kleene star operation is A* = {x 1 x 2 …x k | k ≥ 0 and each x i ∈ A} Exercise A = {w | w is a string of 0 s and 1 s containing an odd number of 1 s } B = {w | w is a string of 0 s and 1 s containing an even number of 1 s } C = {0,1} What are A*, B*, and C* ?

CS 311 Mount Holyoke College 7 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 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

CS 311 Mount Holyoke College 8 Kleene star Theorem: The class of languages recognized by NFAs is closed under the Kleene star operation.

CS 311 Mount Holyoke College 9 If only… … somebody would prove that the class of languages recognized by NFAs and the class of languages recognized by DFAs were equal…

CS 311 Mount Holyoke College 10 Then… We’d have: –The class of regular languages is closed under: Concatenation Kleene star

CS 311 Mount Holyoke College 11 And… a cute proof for closure under union!

CS 311 Mount Holyoke College 12 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…

CS 311 Mount Holyoke College 13 Then there exists a DFA M M is a 5-tuple (Q, Σ, δ M, q 0, F), where – Q is a finite set called the states – Σ is a finite set called the alphabet – δ: Q × Σ → Q is the transition function – q 0 ∈ Q is the start state – F ⊆ Q is a set of accept states

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

CS 311 Mount Holyoke College 15 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, Σ, δ, q 0, F)

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

CS 311 Mount Holyoke College 17 Remember…

CS 311 Mount Holyoke College 18 A simpler example

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

CS 311 Mount Holyoke College 20 Okay, but what about ε arrows?

CS 311 Mount Holyoke College 21 Modifying our construction Proof: Let A be a language accepted by NFA N = (Q, Σ, δ, q 0, F) We construct a DFA M=(Q’, Σ, δ’, q 0 ’, 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 } – q 0 ’ = E({q 0 }) – F’ = { R ∈ Q’ | R contains an accept state from F} r∈Rr∈R