COSC 3340: Introduction to Theory of Computation

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)*
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.
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.
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
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.
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 August 26, 2004.
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.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CS 203: Introduction to Formal Languages and Automata
Lecture 11UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11.
 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.
Intro to Theory of Computation
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
Properties of Regular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
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
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Intro 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:

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

Formal definition of NFA acceptance 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 *(q0, 1) = ? Ans: {q0, q1} *(q0, 11) = ? Ans: {q0, q1, q2} Lecture 4 UofH - COSC 3340 - Dr. Verma

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

NFA vs. DFA Is NFA more powerful than DFA? Theorem: Proof Idea: 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 4 UofH - COSC 3340 - Dr. Verma

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

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

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

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

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

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

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

Language Operations Concatenation. Notation: LL' or just LL' L  L' = {uv | u in L, v in L'}. Kleene Star. Notation: L* L* = { w in * | w = w1...wk for some k >= 0 and each wi 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: {an | n >= 0} U, ., * are called regular operations. Lecture 4 UofH - COSC 3340 - Dr. Verma

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

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

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

Construction for LL' L’’ = (K,,,s,F) K = K1  K2 s = s1 F = F2  = 1  2  F1 X {e} X {s2} Lecture 4 UofH - COSC 3340 - Dr. Verma

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

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

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