Download presentation
Presentation is loading. Please wait.
1
Finite Automata & Regular Languages
Sipser, Chap 1 Hopcroft, Motawi, Ullman, Chap 2
2
Deterministic Finite Automata
A DFA or deterministic finite automaton M is a 5-tuple, M = (Q, , , q0, F), where: Q is a finite set of states of M is the finite input alphabet of M : Q Q is the state transition function q0 is the start state of M F Q is the set of accepting states or final states of M
3
DFA Example State diagram Q = { q0, q1 } = { 0, 1 } F = { q1 } 1
1 M State diagram Q = { q0, q1 } = { 0, 1 } F = { q1 } 1 q0 q1 State Table
4
State table & state transition function
State transition function (q0, 0) = q0, (q0, 1) = q1 (q1, 0) = q1, (q1, 1) = q0 1 q0 q1
5
State transitions If q, q’ Q, s , and (q, s) = q’, then we say that q’ is an s-successor of q, or there is a transition from q to q’ on input s, and we write q s q’ Example: since (q0, 1) = q1, then there is a transition from q0 to q1 on input 1, and we write q0 1 q1.
6
State sequences If a string of input symbols w = s0s1s2 … sk-1 takes M from initial state q0 to state qk, namely q0 s0 q1 s1 q2 s2 q3 … s[k-1] qk then we say that qk is a w-successor of q0, and write q0 w qk. Also q0q1q2 … qk is called an admissible state sequence for w.
7
Strings accepted by a DFA
Let M = (Q, , , q0, F) be a DFA, and w = s0s1s2 … sk-1 * be a string over alphabet . Then M accepts w if there exists an admissible state sequence q0q1q2 … qk for w, starting at initial state q0 and ending with state qk, where qk F. That is, M accepts input string w if M ends up in one of the final states.
8
Language recognized by a DFA
The language L(M) that is recognized by a DFA, M = (Q, , , q0, F), is the set of all strings accepted by M. That is, L(M) = { w * | M accepts w } = { w * | q0 w qk, qk F }. Example: For the previous DFA, L(M) is the set of all strings of 0s and 1s with odd parity, that is, odd number of 1s.
9
DFA Example 2 Recognizer for 11*01* B 1 C A D 0,1 Trap
0,1 * means zero or more occurrences of the preceding symbol Trap
10
DFA Example 2 M = (Q, , , q0, F), L(M) = 11*01* Q = { q0=A, B, C, D } = { 0, 1 } F = { C } 1 A D B C
11
DFA Example 3 Modulo 3 counter B 1 2 A 1 2 2 C 1
12
DFA Example 3 M = (Q, , , q0, F) Q = { q0=A, B, C } = { 0, 1, 2 } F = { A } 1 2 A B C
13
Regular Languages and DFAs
A language L * is called regular if there exists a DFA M such that L(M)=L Examples of regular languages Binary strings with odd parity Language described by 11*01* Strings that form integers divisible by 3
14
Next Variations on Finite Automata; e.g., Nondeterministic Finite Automata (NFAs) Equivalences of these variations with DFAs Regular expressions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.