Lecture 4UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.

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

Lecture 8 From NFA to Regular Language. Induction on k= # of states other than initial and final states K=0 a a* b a c d c*a(d+bc*a)*
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.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
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.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
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.
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.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
Lecture 7UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 7.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
Lecture 5UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 5.
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.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Lecture 2UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 2.
Lecture 10UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 10.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
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.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Lecture 11UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
 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.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Lecture 8UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 8.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Properties of Regular Languages
CSE 105 theory of computation
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
Single Final State for NFA
COSC 3340: Introduction to Theory of Computation
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
COSC 3340: Introduction to Theory of Computation
Lecture3 DFA vs. NFA, properties of RL
Closure Properties for Regular Languages
Non-Deterministic Finite Automata
CSE322 PROPERTIES OF REGULAR LANGUAGES
COSC 3340: Introduction to Theory of Computation
CSE 2001: Introduction to Theory of Computation Fall 2009
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
CSE 105 theory of computation
Chapter 1 Regular Language
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4

UofH - COSC Dr. Verma 2 Define  *(q, w) as a set of states: p ε  *(q, w) if there is a directed path from q to p labeled w – Example: consider NFA of Lecture 3  *(q 0, 1) = ? – Ans: {q 0, q 1 }  *(q 0, 11) = ? – Ans: {q 0, q 1, q 2 } Formal definition of NFA acceptance

Lecture 4UofH - COSC Dr. Verma 3 NFA acceptance (contd.) w is accepted by NFA M iff  *(q 0, w)  F is nonempty. L(M) = {w in  * | w is accepted by M}.

Lecture 4UofH - COSC Dr. Verma 4 NFA vs. DFA Is NFA more powerful than DFA? – Ans: No. Theorem: – For every NFA M there is an equivalent DFA M' Proof Idea: – NFA is in a set of states at any point during reading a string. – DFA will use a lot of states to keep track of this. Important Assumption: – No transition labeled by epsilon. (Will get rid of this assumption later.)

Lecture 4UofH - COSC Dr. Verma 5 Equivalent DFA construction. NFA M = (Q, , , s, F) DFA M' = (Q', , , s', F') where: – Q' = 2 Q – s' = {s} – F' = {P | P  F is nonempty} –  ({p 1, p 2, p m },  ) =  *(p 1,  )   *(p 2,  ) ...   *(p m,  ) i.e. find all the states that can be reached on  from all the NFA states in a DFA state.

Lecture 4UofH - COSC Dr. Verma 6 Example: Equivalent DFA construction NFA

Lecture 4UofH - COSC Dr. Verma 7 Equivalent DFA construction (contd.)

Lecture 4UofH - COSC Dr. Verma 8 How to handle epsilon transitions? Define e-closure of state q as  *(q,  ). – notation: e-closure(q). Example:

Lecture 4UofH - COSC Dr. Verma 9 Handling epsilon transitions (contd.) Extend e-closure to sets of states by: – e-closure({s 1,..., s m }) = e-closure(s 1 ) ...  e-closure(s m ) Now let s' = e-closure({s}). and,  ({p 1,..., p m },  ) = e-closure(  *(p 1,  )) ...  e-closure(  *(p m,  )) to complete construction of DFA.

Lecture 4UofH - COSC Dr. Verma 10 Example: Handling epsilon transitions.

Lecture 4UofH - COSC Dr. Verma 11 DFA = ?

Lecture 4UofH - COSC Dr. Verma 12 Language Operations 1. Concatenation. Notation: L  L' or just LL' – L  L' = {uv | u in L, v in L'}. 2. Kleene Star. Notation: L* – L* = { w in  * | w = w 1...w k for some k >= 0 and each w i in L}. Examples : if L = {a (2n+1) | n >= 0}. L' = {b (2n) | n > = 0}. LL' = ? – Ans: LL' = { a (2n+1) b (2m) | n, m > = 0} L* = ? – Ans: {a n | n >= 0} U,., * are called regular operations.

Lecture 4UofH - COSC Dr. Verma 13 Closure properties of regular languages. Previously we saw closure under  and . New: Regular languages are closed under – Concatenation – Kleene star – Complement.

Lecture 4UofH - COSC Dr. Verma 14 Examples L = {w in {a,b}* | w has even a’s }

Lecture 4UofH - COSC Dr. Verma 15 Examples L' = {w in {a,b}* | w has at least one b}

Lecture 4UofH - COSC Dr. Verma 16 Construction for L  L' L’’ = (K, , ,s,F) K = K 1  K 2 s = s 1 F = F 2  =  1   2  F 1 X {e} X {s 2 }

Lecture 4UofH - COSC Dr. Verma 17 L * and L' * L* L’* M = (K, , , s, F) K = {s}  K 1 F = {s}  F 1  =  1  F 1 X {e} X {s 1 }  {(s, e, s 1 )} Given M 1 = (K 1, ,  1, s 1, F 1 )

Lecture 4UofH - COSC Dr. Verma 18 Complement of L and L' Complement of L Complement of L’

Lecture 4UofH - COSC Dr. Verma 19 General Construction for Complement DFA M = (K, , δ, s, F) K = K 1 s = s 1 F = K - F 1 δ = δ 1 L(M) = Complement of L(M 1 ) DFA M 1 = (K 1, , δ 1, s 1, F 1 ) Exercise: Will this construction work for NFAs? Explain your answer.