Introduction to Automata Theory Theory of Computation Lecture 3 Tasneem Ghnaimat
Finite Automata The finite state machine(FSM) or finite automaton (FA) is the simplest computational model of limited memory computers. Example: an automatic door opener at a supermarket decides when to open or close the door, depending on the input provided by its sensors. Tasneem Ghnaimat
Finite Automata Finite automata are designed to solve decision problems, i.e., whether an input satisfies some conditions. Examples of decision problems: – Does a given string have an even number of 1‘s – Is the number of 0's (in a string) multiple of 4 – Does a given string end in 00. Tasneem Ghnaimat
Example – Door opener States: closed, open Input conditions: front, rear, both, neither Transitions: – closed open on front – open closed on neither Rear, Both, Neither Front, Rear, Both Front Neither Closed Open
Formal Definition A deterministic finite automaton (DFA) or (FSM) is a 5-tuple M= (Q, ∑, σ, q 0, F ), where: Q: is a finite set whose members are called states ∑ : is a finite alphabet whose members are called symbols σ : Q X ∑ Q is the transition function q 0 Q : is the start state F : is the set of accept states (or final states). Tasneem Ghnaimat
Formal Definition Given an input string over ∑ (written on the input tape), an automaton reads its symbols one-by-one and changes its state (starting from q 0 ) according to σ The automaton “accepts” the input if its resulting state (after reading the input string is complete) belongs to F, otherwise “rejects”. Tasneem Ghnaimat
Apply Definitions on Door Opener Q= {Closed, Open} ∑={Front, Rear, Both, Neither} State Transition Table Tasneem Ghnaimat NeitherBothRearFront Closed OpenClosed Open
Drawing State Diagram Draw a state diagram of a DFA M1 with state set Q={q1,q2,q3}, ∑={0,1}, start state q1, final state set F={q2}, and state transition table is: Tasneem Ghnaimat 10 q2q1 q2q3q2 q1q2q3
Examples Example 1: Consider the following Automata (M2): The machine accepts all strings that leave it in an accept state when it has finished reading. Note: because start state is the final state, M2 will accepts the string (Epsilon) Tasneem Ghnaimat q1 q2 q1
Examples The Language of Machine M2 is described as: L(M2)= {w|w is the empty string or ends with 0}. Example 2: Consider the following Automata (M3) Tasneem Ghnaimat
Examples Example 2: Consider the following Automata (M3) Tasneem Ghnaimat q1 q2
Examples The Language of Machine M2 is described as: L(M2)= {w|w is a string ends with 1}. Example 2: Consider the following Automata (M3) Tasneem Ghnaimat