Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 2670 Introduction to Theory of Computing

Similar presentations


Presentation on theme: "CSCI 2670 Introduction to Theory of Computing"— Presentation transcript:

1 CSCI 2670 Introduction to Theory of Computing
August 30, 2005

2 Announcements Homework due next Tues, Sept 6
1.7b, 1.8a, 1.10a, 1.15, 1.17a&b, 1.31, 1.32 Old Text 1.5b, 1.6a, 1.8a, 1.24, 1.25 (1.15 & 1.17 are not in old text) Office hours with TA Ryan Foster Monday 2:30 – 3:30 Friday 10:00 – 11:00 Room 301 B (knock if locked) Change in syllabus First midterm exam Tues, September 27

3 Agenda Last class This week Combined regular languages
Introduced non-determinism This week Section 1.2 Start Section 1.3

4 Find M such that L(M) = L(M1)  L(M2)
q1 q2 q3 0,1 1 M1 1 q1’ q2’ q3’ M2 Example Find M such that L(M) = L(M1)  L(M2) q1 q2 q3 0,1 1 q1’ q2’ q3’ ε Can jump to q1’ non-deterministically

5 NFA vs. DFA DFA NFA Exactly one arrow exiting each node for each symbol of the alphabet Number of exiting arrows can be anything from 0 to the number of nodes Each arrow is labeled only with characters of the alphabet Characters may be labeled with an empty string, ε Each string reaches exactly one state at the end of the input A string may reach several different states states at the end of the input

6 Computing on an NFA For each symbol of the string, keep track of all possible transitions in parallel When input ends, there may be several possible ending states If at least one of the possibilities is an accepting state, then the NFA accepts the string

7 Example Does this NFA accept the string 001? From state(s) Input
0,1 1 q1 q2 ε q3 1 1 Does this NFA accept the string 001? From state(s) Input To state(s) q1 q2, q3 1 q1, q3 Yes q1, q3

8 Example Any string containing two 1’s separated by at most one 0 0,1 1
ε Any string containing two 1’s separated by at most one 0

9 Example Zero or more concatenations of the strings aba and ab   b a

10 Example ε a, b, c a, b, d a, c, d b, c, d Strings of any length containing at most three of the symbols in  = {a, b, c, d}

11 The power of non-determinism
Strings of any length containing at most two of the symbols in  = {a, b, c} c a b a, b, c a, c b,c a, b DFA a, b a, c b, c ε NFA

12 Non-deterministic finite automaton
A non-deterministic finite automaton is a 5-tuple (Q,,,q0,F), where Q is a finite set of states  is a (finite) alphabet  : Q × ε  P(Q) is the transition function  maps to sets of states q0 is the start state, and F  Q is the set of accept states

13 Equivalence of DFAs and NFAs
Theorem: Every non-deterministic finite automaton has an equivalent deterministic finite automaton Both FAs accept the same language Proof method Construction Similar to method used for calculating strings Follow all paths in parallel where states represent parallel paths

14 Proof idea Given NFA M1={Q,,,q0,F} construct DFA M2={Q’,,’,q0’,F’} with L(M1)=L(M2) Intuition Recall :Q×εP(Q) Our DFA’s transition function will generate paths within P(Q) ’: P(Q)×P(Q)

15 Defining M2 Determine Q’, q0’, and F’
Q’ = P(Q) q0’ = {q0} F’ = {R  Q’ | R  F  } i.e., R contains at least one of M1’s accept states Defining ’ (for now ignore ε jumps)


Download ppt "CSCI 2670 Introduction to Theory of Computing"

Similar presentations


Ads by Google