Lecture 6 NFA Subset Construction & Epsilon Transitions

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
NFAs and DFAs Sipser 1.2 (pages 47-63). Last time…
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
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.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
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.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2009 with acknowledgement.
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.
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.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
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.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Chapter 2 Finite Automata (part b) Windmills in Holland.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
Lesson No.6 Naveen Z Quazilbash. Overview Attendance and lesson plan sharing Assignments Quiz (10 mins.). Some basic ideas about this course Regular Expressions.
Regular Expressions Costas Busch - LSU.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Lecture 8 NFA Subset Construction & Epsilon Transitions
Lecture 10 Closure Properties of Regular Languages Topics: Extended RegExpr Thompson Construction Test 1 Post Mortem October 1, 2008 CSCE 355 Foundations.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Lecture 11 Minimization Topics: Strings distinguishing states Equivalence relation October 6, 2008 CSCE 355 Foundations of Computation.
Lecture 5 NFAs Topics: Induction review/PopQuiz NFAs Delta, delta hat Strings accepted, languages accepted Subset Construction June 5, 2015 CSCE 355 Foundations.
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.
CIS Automata and Formal Languages – Pei Wang
Non Deterministic Automata
CSCE 355 Foundations of Computation
CSE 105 theory of computation
Regular Expressions Sections:1.3 page 63 September 17, 2008
Nondeterministic Finite Automata
Lecture 10 Closure Properties of Regular Languages
Single Final State for NFA
CS 154, Lecture 4: Limitations on DFAs (I),
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
4. Properties of Regular Languages
Non-Deterministic Finite Automata
Nondeterministic Finite Automata
NFA vs DFA DFA: For every state q in S and every character  in , one and only one transition of the following form occurs:  q q’ NFA: For every state.
Finite Automata Reading: Chapter 2.
Definitions Equivalence to Finite Automata
CSE 2001: Introduction to Theory of Computation Fall 2009
CSCI 2670 Introduction to Theory of Computing
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSE 311 Foundations of Computing I
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
Chapter 1 Regular Language
NFA’s With ε-Transitions
CSCI 2670 Introduction to Theory of Computing
NFAs accept the Regular Languages
CSCE 355 Foundations of Computation
CSCI 2670 Introduction to Theory of Computing
CSCE 355 Foundations of Computation
COSC 3340: Introduction to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Lecture 6 NFA Subset Construction & Epsilon Transitions CSCE 355 Foundations of Computation Lecture 6 NFA Subset Construction & Epsilon Transitions Topics: Examples Subset Construction Author’s Website again Epsilon transitions Ruby - dfa1.rb Sept 15, 2008

New: Readings section 2.2.3-2.4 Last Time: Readings 2.3 HW Hints and Induction example Review Induction DFA for Union, revisit Example 2.4 Pop Quiz Uses of Finite automata NFA Delta-hat, a string accepted by an NFA, the language accepted Subset construction converting NFA  equivalent DFA TEST 1 – Monday New: Readings section 2.2.3-2.4 Examples Subset construction converting NFA equivalent DFA Author’s Website Solutions Online

NFA example Figure 2.9 Page 56 Transition Table (NFA) x What does the p mean? What does the *r mean? What is δ(s, x) informally? 1 p q r 0,1 State\Input 1 p { p, q } q *r

Subset Construction example Figure 2.9 Page 56 of text 1 p q r Equivalent DFA Table State\Input 1 { p } { p, q} { p } { p, r} *{ p, r} 0,1

Subset Construction example Figure 2.9 Page 56 of text 1 p q r Equivalent DFA Table State\Input 1 { p } { p, q} { p } { p, r} *{ p, r} 0,1

Subset Construction Significance Constructing an equivalent DFA from and NFA What does equivalent mean? Does equivalent mean have the same number of states? Equivalent means  Why convert? What is better about an NFA? What is better about a DFA? We are interested in the power of these models? Can an NFA recognize a language that a DFA can’t? Can a DFA recognize a language that an NFA can’t?

Exercise 2.2.9 Solutions Online Author’s Website for Text http://infolab.stanford.edu/~ullman/ialc.html HW Solutions for starred (*) problems http://infolab.stanford.edu/~ullman/ialcsols/sol2.html 2.2.9 page 54 Prove If δ(q0, a) = δ(qf, a) for all a in Σ then for all w != ε we have δ(q0, w) = δ(qf, w) by induction on the length of w. Basis Assume Then we need to show that Dr. Ullman’s (Jeff’s) slides from CS 154 http://infolab.stanford.edu/~ullman/ialc/jdu-slides.html

Homework and Test 1 HW 2 Extra Credit HW 3 HW 4 Pop Quiz http://infolab.stanford.edu/~ullman/ialc/slides/slides1.pdf HW 3 4a 4b 5 6 HW 4 Pop Quiz

Subset Example from Author’s website slides2.pdf

Mutual Induction Proof Write up on back of Lecture Overview

Consider our old friend from HW 2. 2. 5b: L = {w ε {0,1} Consider our old friend from HW 2.2.5b: L = {w ε {0,1}* | the tenth symbol from the right end of w is a ‘1’ } 0,1 0,1 0,1 1 0,1 3 4 … 10 1 2 0,1 If we convert an NFA with n states to a DFA using the subset construction what is the max number states in the DFA? Can we do better? Subset construction an example of “lazy evaluation” – i.e. consider only states we can get to from q0 DFA minimization is a topic for later

Ruby: Strings and DFAs (dfa1.rb) # DFA1.rb on Handouts page Now consider how to generate all strings in Σ* of length 6 # Idea: generate them from a list of the strings of length n-1 # by concatenating onto each string w of length n-1 each a ε Σ (a recursive definition) # lists of strings of length n-1 and n strnm1 = Array.new(); strn = Array.new(); strnm1 = ["a", "b"] print "strnm1 = #{strnm1}\n“

[2,3,4,5, 6, 7, 8]. each { |len| numstrings = 0 strnm1 [2,3,4,5, 6, 7, 8].each { |len| numstrings = 0 strnm1.each { |str| alphabet.each { |chr| x = chr + str strn[numstrings] = x numstrings = numstrings + 1 } print "Strings of length #{len}:\n" strn.each { |str| print "#{str}\n" } strnm1 = strn strn = Array.new

Theorem 2.11 For NFA there is Eq. DFA

Theorem 2.12 L is accepted by DFA if and only if L is accepted by NFA

Epsilon (ε)-Transitions Keyword Searching Example : for, format, font

Epsilon Closure

Equivalent NFA (without ε) for an NFA with ε Convert NFA with ε to an equivalent NFA without ε Compute transitive closure of ε arcs If p can reach state q by ε arcs and δ(r, a) contains p (there is a transition from r to q on input a) then add q to δ(r, a) i.e. add a transition from r to q on input a xx

References and Homework Ruby pickaxe book Online http://whytheluckystiff.net/ruby/pickaxe/ Author’s Website for Text http://infolab.stanford.edu/~ullman/ialc.html Slides, HW, Exams