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
September 4, 2007

2 Languages Alphabet String Language
Finite collection of objects (denoted )‏ String Concatenation of 0 or more elements of an alphabet Language Collection of strings * is the set of all strings over  (including ε)‏ This week we will define a specific class of languages – regular languages August 23, 2005

3 Deterministic finite automata (DFA)‏
Method for modeling computers with limited memory Language recognizer Idea Keep track of current state Events can move you from one state to another Today’s goal Formally describe DFA’s Interpret DFA’s August 23, 2005

4 Example Ball in frictionless room Moves left, right or not at all
Three possible states: left, right, stop One other state: impossible Start at rest (in stop state)‏ State changes under four conditions Ball hits a wall (reverse direction)‏ Paddle hits left (ball moves left)‏ Paddle hits right (ball moves right)‏ Hand grabs ball (stop moving)‏ August 23, 2005

5 Example State table Stop Right Left Impossi ble Grab Paddle Right
Paddle Left Hits Wall Event State August 23, 2005

6 Example Left Stop Right Ball hits a wall (reverse direction)‏
Ball in frictionless room Ball hits a wall (reverse direction)‏ Paddle hits left (ball moves left)‏ Paddle hits right (ball moves right)‏ Hand grabs ball (stop moving)‏ Left Stop Right Impossible August 23, 2005

7 Finite automaton (formal definition)‏
A finite automaton is a 5-tuple (Q,,,q0,F), where Q is a finite set called the states  is a finite set called the alphabet  : Q ×   Q is the transition function  corresponds to the event function from previous example q0 is the start state, and F  Q is the set of accept states (also called final states). August 23, 2005

8 Example From previous example Q =  =  = q0 = F =
{Left, Right, Stop, Impossible} {Hit wall, Paddle left, Paddle right, Grab} The state table we constructed Stop {Left, Right, Stop} What if we accept any set of events that ends with the ball in motion? F = {Left, Right} August 23, 2005

9 Another example  = {0,1} q4 q1 q2 q3 Q =  =  q0 = F =
1 1 q1 q2 1 q3 Q =  = q0 = F = {q1, q2, q3, q4} {0, 1} (next slide)‏ q1 {q3} August 23, 2005

10 Another example  = {0,1} q4 q1 q2 q3 q4 q3 q2 q1 1 State table 0,1 1
1 1 q1 q2 1 q3 q4 q3 q2 q1 1 State table August 23, 2005

11 Another example  = {0,1} q4 q1 q2 q3
1 1 q1 q2 1 q3 Informal description of the strings accepted by this DFA All strings of 0’s and 1’s beginning with a 0 and ending with a 1 August 23, 2005

12 Group problem Formally describe the DFA (deterministic finite automaton) illustrated in your group’s sheet August 23, 2005

13 Group problem = {0, 1} for all groups Include informal description
Q is a finite set called the states  is a finite set called the alphabet  : Q ×   Q is the transition function q0 is the start state, and F  Q is the set of accept states (also called final states). Include informal description August 23, 2005

14 Group 1 q1 q2 q3 q4 q5 Hint: What string doesn’t this DFA accept? 0,1
q2 1 q3 q4 1 1 q5 0,1 Hint: What string doesn’t this DFA accept? August 23, 2005

15 Group 2 q2 q3 q1 q4 q5 Hint: String length counts. 0,1 0,1 0,1 1 0,1
q1 0,1 1 q4 0,1 q5 Hint: String length counts. August 23, 2005

16 Group 3 q1 q2 q3 Hint: Symbol position counts. 0,1 1 0,1
q3 0,1 Hint: Symbol position counts. August 23, 2005

17 Group 4 q1 q2 q3 q4 Hint: Can you simplify this DFA? 1 0,1 0,1 0,1
q1 q2 1 0,1 0,1 q3 0,1 q4 Hint: Can you simplify this DFA? August 23, 2005

18 0,1 q7 Group 5 1 q1 1 q3 q5 1 q4 q2 1 q6 1 Hint: For each state, what do you know about how many times each symbol has appeared? August 23, 2005

19 Group 6 q1 q2 q3 Hint: What happens when you get to q3? 1 1 0, 1
q1 1 q2 1 q3 0, 1 Hint: What happens when you get to q3? August 23, 2005


Download ppt "CSCI 2670 Introduction to Theory of Computing"

Similar presentations


Ads by Google