CSCI 267 Introduction to Theory of Computing
Agenda Last class Reviewed syllabus Reviewed material in Chapter of Sipser Assigned pages Chapter of Sipser Questions? This class Begin Chapter Goal for the week Section. Read Section. (pages 29 47) this week 2
Announcements Website is up Quiz tomorrow (8/24) Material: Chapter Homework due next Tuesday (8/3) Chapter numbers.3 all,.7b,.2 Chapter numbers.3,.4c,.5f,.6(a, c, h) Unregistered students Please give me your student id after class 3
Relation on A Function R:A A A {true, false} Often described as a set of elements for which the relation is true Example A={,2,3,4,5} R:A A A {true, false} R is true if the three-tuple is increasing {(,2,3),(,2,4),(2,3,4),(3,4,5)} R (,,5) R 4
Graphical representation (binary relations only) Directed arrow with edge (a,b) if (a,b) R Example: A={a,b,c,d}, R= earlier in alphabet R={(a,b),(a,c),(a,d),(b,c),(b,d),(c,d)} a b c d 5
Symmetric Equivalence Relation {(a,a) a A} R Reflexive (a,b) R (b,a) R Transitive (a,b) R (b,c) R (a,c) R Examples Equality Has the same eye color 6
Languages Alphabet Finite collection of objects (denoted Σ) String Concatenation of 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 7
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 8
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) 9
Example State table State Event Hits Wall Paddle Left Paddle Right Grab Left Right Left Right Stop Right Left Left Right Stop Stop Impossi ble Left Right Stop Impossible Impossible Impossible Impossible Impossible
Example» 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 Right Stop Impossible
Finite automaton (formal definition) A finite automaton is a 5-tuple (Q,Σ,δ,q,F), where. Q is a finite set called the states 2. Σ is a finite set called the alphabet 3. δ : Q Σ Q is the transition function δ corresponds to the event function from previous example 4. q is the start state, and 5. F Q is the set of accept states (also called final states). 2
Example From previous example Q = Σ = δ = q = 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} 3
q 4 Another example Σ = {} q q 2 q 3 Q = Σ = δ q = F = {q, q 2, q 3, q 4 } {, } (next slide) q {q 3 } 4
q 4 Another example Σ = {} q q 2 q 3 State table q q 2 q 4 q 2 q 2 q 3 q 3 q 2 q 3 q 4 q 4 q 4 5
q 4 Another example Σ = {} q q 2 q 3 Informal description of the strings accepted by this DFA All strings of s and s beginning with a and ending with a 6
Group problem Formally describe the DFA (deterministic finite automaton) illustrated in your group s sheet 7
Group problem Σ = {, } for all groups. Q is a finite set called the states 2. Σ is a finite set called the alphabet 3. δ : Q Σ Q is the transition function 4. q is the start state, and 5. F Q is the set of accept states (also called final states). Include informal description 8
Group q 3 q q 2 q 4 q 5 Hint: What string doesn t this DFA accept? 9
Group 2 q 2 q 3 q q 4 q 5 Hint: String length counts. 2
Group 3 q q 2 q 3 Hint: Symbol position counts. 2
Group 4 q q 2 q 3 q 4 Hint: Can you simplify this DFA? 22
Group 5 q 7 q q 3 q 5 q 2 q 4 q 6 Hint: For each state, what do you know about how many times each symbol has appeared? 23
Group 6 q q 2 q 3, Hint: What happens when you get to q 3? 24