Deterministic Finite Automata and Turing Machine
Deterministic Finite Automata and Turing Machine
- The finite automaton (FA) is a mathematical model of a system, with discrete inputs
and outputs.
- A finite automaton consists of a finite set of states, and a set of transitions from states
to states that occur in response to external “inputs” chosen from an alphabet .
- The purpose of a state is to remember the relevant portion of the system’s history.
Since there are only a finite number of states, the entire history generally cannot be
remembered. So, the system must be designed carefully.
- A state of the system summarizes the information concerning past inputs that is
needed to determine the behavior of the system on subsequent inputs.
- Example: On/Off switch, the control mechanism of an elevator etc.
- Deterministic vs Nondeterministic: The control is “deterministic”, meaning that the
automaton cannot be in more than one state at any one time or “nondeterministic”,
meaning that it may be in several states at once.
Formal Definition of DFA: A DFA is a quintuple (5-tuple), that is, a system which consists
of 5 elements. We write,
A = (Q, , , q0, F), where
- Q: finite nonempty set of states;
- (capital sigma): finite nonempty set of input symbols, input alphabet;
- (small delta): transition function that takes as arguments a state and an input
symbol and returns a state, : Q x → Q;
- q0: initial/start state, q0 Q;
- F: set of final or accepting states, F Q.
Example: Specify a DFA that accepts all and only the strings of 0’s and 1’s that have the
sequence 01 somewhere in the string.
So, L: {w | w is of the form x01y for some string x and y consisting of 0’s and 1’s only}
= {0, 1}, Say initial state q0.
Page 1 of 4
CSE1203: Discrete Mathematics
This automaton has to remember the important facts about what inputs it has seen so far. To
decide whether 01 is a substring of the input, the automaton needs to remember:
1. Has it already seen 01? If so, then it accepts every sequence of further inputs. (Say,
state q2)
2. Has it never seen 01, but its most recent input was 0, so if it now sees a 1, it will have
seen 01 and can accept everything it sees from here on? (Say, state q1)
3. Has it never seen 01, but its last input was either nonexistent (it just started) or it last
saw a 1? (Say, state q0)
Transition diagram:
1 0 0,1
0 1
q0 q1 q2
Transition Table:
0 1
q0 q1 q0
q1 q1 q2
*q2 q2 q2
Here,
Q = {q0, q1, q2},
= {0, 1},
= {((q0, 0), q1), ((q0, 1), q0), ((q1, 0), q1), ((q1, 1), q2), ((q2, 0), q2), ((q2, 1), q2)},
q0 and F = {q2}.
Page 2 of 4
CSE1203: Discrete Mathematics
Formal Definition:
- A Turing Machine (TM) is a mathematical model which consists of an infinite length
tape divided into cells on which input is given. It consists of a head which reads the
input tape. A state register stores the state of the Turing machine.
- After reading an input symbol, it is replaced with another symbol, its internal state is
changed, and it moves from one cell to the right or left. If the TM reaches the final
state, the input string is accepted, otherwise rejected.
- A TM can be formally described as a 7-tuple (Q, X, ∑, δ, q0, B, F) where,
- Q: finite nonempty set of states;
- X: tape alphabet;
- : finite nonempty set of input symbols, input alphabet;
- : transition function; δ : Q × X → Q × X × {Left_shift, Right_shift};
- q0: initial/start state, q0 Q;
- B: blank symbol;
- F: set of final or accepting states, F Q
- is given by-
Tape alphabet symbol Present state ‘qo’ Present state ‘q1’ Present state ‘q2’
a 1Rq1 1Lq0 1Lqf
b 1Lq2 1Rq1 1Rqf
Page 3 of 4
CSE1203: Discrete Mathematics
Here the transition 1Rq1 implies that the write symbol is 1, the tape moves right, and the
next state is q1. Similarly, the transition 1Lq2 implies that the write symbol is 1, the tape
moves left, and the next state is q2.
Page 4 of 4