Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter 2002-2003.

Slides:



Advertisements
Similar presentations
CSE 311 Foundations of Computing I
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.
Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Introduction to Computability Theory
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
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.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
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.
CSCI 2670 Introduction to Theory of Computing August 25, 2005.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Complexity and Computability Theory I Lecture #2 Rina Zviel-Girshin Leah Epstein Winter
Complexity and Computability Theory I Lecture #11 Instructor: Rina Zviel-Girshin Lea Epstein.
Complexity and Computability Theory I Lecture #8 Instructor: Rina Zviel-Girshin Lea Epstein.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Introduction to the Theory of Computation Regular Expressions.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
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:
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Languages.
Non Deterministic Automata
CSE 105 theory of computation
Formal Language & Automata Theory
Complexity and Computability Theory I
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Lecture3 DFA vs. NFA, properties of RL
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
CSE 311: Foundations of Computing
CSE 2001: Introduction to Theory of Computation Fall 2009
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
Finite-State Machines with No Output
CSCI 2670 Introduction to Theory of Computing
NFAs accept the Regular Languages
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Presentation transcript:

Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter

Rina Overview Equivalence of the nondeterministic model to the deterministic model revisited Examples Closures of regular languages

Rina DFA construction algorithm Let A be an NFA where A = (Q A, ,  A, q 0A, F A ). We construct a DFA M equivalent to A, where M = ( Q, , , q 0, F). Q = P(Q A )  =  For each R in Q and  in   (R,  ) is q 0 = E(q 0A ) F = { R  Q | there exists r  R such that r  F A } AA

Rina Explanation Create all the subsets of set of states of A. Those will become the states of M. The alphabet remains the same. The transition function : for each state m in M and a letter  find what are the states qi..qj in A included in m for each qi  m find a set R of states which you can reach in A using  -closure, letter  and  -closure unite all the sets R you reach one set : S the next state of m on  in M is S.

Rina Explanation The initial state in M is the set which includes only E(q 0A ). The final states in M - all the sets in which at least one state is final (accepting) state in A. Eliminate all the unreachable states in M - states to which the is no path from the initial state of M. The automaton you have is deterministic automaton equivalent to A.

Rina Formal proof We prove that L(M)=L(A). First we show that for each word w  *,  A ’(q 0A,w) =  ’(q 0,w). We use induction.

Rina  A ’(q 0A,w) =  ’(q 0,w) Induction basis: w= .  A ’(q 0A,  ) = P   A ’(q 0A, .. ..  ) = P  P =  ’(q 0,  ). Induction hypothesis: Assume that theorem is true for some word w:  A ’(q 0A,w) =  ’(q 0,w) Induction step: Proof that the theorem is true for w .  A ’(q 0A, w  ) =  ’ A (  A ’(q 0A, w),  )  by induction hypothesis   ’ A (  ’(q 0, w),  )  by definition of    ’(  ’(q 0, w),  )=  ’( q 0, w  ).

Rina L(M)=L(A) w  L(A)   A ’(q 0A,w)=P and P  F A   by definition of F   A ’(q 0A,w) =P and P  F  by the previous theorem   ’(q 0,w) =P and P  F  w  L(M)

Rina Example Convert a given nondeterministic finite automaton to a deterministic finite automaton. A:

Rina Example Using the algorithm we construct the following automaton: M:

Rina Example Convert a given nondeterministic finite automaton to a deterministic finite automaton. B:

Rina Example Using the algorithm we construct the following states: M:

Rina Example M:

Rina Example Some states of this automaton are unreachable from q0. After elimination of all unreachable states in M the resulting automaton is:

Rina Theorem Every NFA with  -transitions has an equivalent NFA without  -transitions. Proof idea: We give a constructive proof - by giving an algorithm to build a NFA without  - transitions which is equivalent to a given NFA.

Rina Constructive proof Let EM be NFA with  -transitions where EM = (Q EM, ,  EM, q 0EM, F EM ). We will construct an NFA without  -transitions ND which is equivalent to EM, where ND= (Q, , , q 0, F). Q= Q EM  =  For each q in Q and  in   (q,  ) is E(  EM (E(q),  )=  EM (q,  …   ..  ) (This means you have to add new edges to automaton ND)

Rina Constructive proof q 0 =q 0EM F: –if E(q 0EM )  F =  (the empty word does not belong to L(EM)) then F= F EM –else (the empty word belongs to L(EM)) F= F EM  {q 0EM }

Rina Example Build a NFA without  -transitions which is equivalent to a given NFA with  -transitions. q1 1 2 q2 q0 0 

Rina  (q0,0)={q0,q1,q2}  (q0,1)={q1,q2}  (q0,2)={q2} q1 1 2 q2 q0 0   (q1,0)=?  (q1,1)={q1,q2}  (q1,2)={q2}  (q2,0)=?  (q2,1)=?  (q2,2)={q2} q1 1 q0 0 2 q2 0,11,2 0,1,2

Rina A NFA without  -transitions We use an NFA without  -transitions to construct a DFA that is equivalent to a given NFA with  -transitions. Basic construction idea: –We are given an NFA EM with  -transitions –Build an NFA M without  -transitions –Build a DFA D equivalent to M.

Rina Example Build a DFA equivalent to a given NFA. q1 1 2 q2 q0 0  EM:

Rina Example The NFA M without  -transitions: M: q1 1 q0 0 2 q2 0,11,2 0,1,2

Rina Example A DFA D equivalent to M: D: 0 q0,1,2 q0 2 q q1,  0,1,2 0 0,1 2

Rina Closure of regular languages Theorem: The class of languages accepted by finite automata is closed under: union concatenation Kleene (star) closure.

Rina Basic proof idea Proof by construction: In each case we will construct an automaton M that accepts the appropriate language. We will use non-deterministic models.

Rina Union Let M 1 recognize L 1 where M 1 = (Q 1, ,  1, q 01, F 1 ) and M 2 recognize L 2 where M 2 = (Q 2, ,  2, q 02, F 2 ). Construct M to recognize L 1  L 2, where M = ( Q, , , q 0, F).

Rina Union

Rina Union We construct M in a way that uses nondeterminism to “guess” whether the input word w is in L 1 or L 2 and then process the string exactly as the corresponding automaton (M 1 or M 2 ).

Rina Union M = ( Q, , , q 0, F) where Q=Q 1  Q 2  {q 0 }   =  1  2  {  (q 0,  )=q 01,  (q 0,  )=q 02 } q 0 F=F 1  F 2

Rina Proof We gave the formal proof during the last lecture. The basic idea of the proof is: if w  *, then  ’(q 0,w)=q for some q  F iff either  ’(q 01,w)=q for some q  F 1 or  ’(q 02,w)=q for some q  F 2 Hence M accepts w iff M 1 accepts w or M 2 accepts w.

Rina Concatenation Let M 1 recognize L 1 where M 1 = (Q 1, ,  1, q 01, F 1 ) and M 2 recognize L 2 where M 2 = (Q 2, ,  2, q 02, F 2 ). Construct M to recognize L 1  L 2, where M = ( Q, , , q 0, F).

Rina Concatenation

Rina Concatenation We construct M that simulates M1 for a while Then M "jumps" nondeterministically from a final state of M1 to the initial state of M2 And then M will simulate M2 for the rest of the input.

Rina Concatenation M = ( Q, , , q 0, F) where Q=Q 1  Q 2  =  1  2  {for each state f  F1  (f,  )=q 02 }  q 0 =q 01 F= F 2

Rina Proof The basic proof idea is: if w  *, then  ’(q 0,w)=q for some q  F iff w=uv and  ’(q 01,u)=f for some f  F 1 and  ’(q 02,v)=q for some q  F 2. Hence M accepts w iff M 1 accepts u and M 2 accepts v.

Rina Kleene star Let M 1 recognize L 1 where M 1 = (Q 1, ,  1, q 01, F 1 ). Construct M to recognize L 1 *, where M = ( Q, , , q 0, F).

Rina Kleene (star) closure We will construct M in a way similar to concatenation. M simulates M 1 on w all the way plus it has an option to go back to q 01. M also excepts .

38 Kleene (star) closure M = ( Q, , , q 0, F) where Q=Q 1  {q 0 }  =  1   (q 0,  )=q 01   {for each state f  F  (f,  )=q 01 }  q 0 =q 0 F= {q 0 }  F 1

Rina Any Questions?