Unit - 1
Unit - 1
(AUTONOMOUS)
B.Tech – II-II Sem LTPC
3003
Why Study Automata Theory? The Central Concepts of Automata Theory, Automation, Finite
Automation, Transition Systems, Acceptance of a String by a Finite Automation, DFA, Design of
DFAs, NFA, Design of NFA, Equivalence of DFA and NFA, Conversion of NFA into DFA,
Finite Automata with E-Transition, Minimization of Finite Automata, Mealy and Moore
Machines, Applications and Limitation of Finite Automata.
Learning Outcomes:
At the end of the unit, students will be able to:
Distinguish DFA and NFA.
Construct DFA for an input string.
Perform minimization of Automata.
Compare Moore and Mealy Machines.
2. Regular Expressions also denote the structure of data strings are exactly the same as what can be
described by finite automata. The style of these expressions significantly from that of grammars we
shall content ourselves with a simple example here The UNIX style regular expression words
followed by a space and two capital letters This expression rep resents patterns in text that could be a
city and state. It misses multiword city names captured by the more complex expression
1.1.3 Automata and Complexity
Automata are essential for the study of the limits of computation. What can a computer do at all? This
study is called decidability and the problems that can be solved by computer are called decidable.
What can a computer do eficiently? This study is called intractability and the problems that can be
solved by a computer using no more time than some slowly growing function of the size of the input
are called tractable.
II. The Central Concepts of Automata Theory
III. Automation
What is Automation?
Automation is a technique that is used to complete the tasks with minimal or no human
intervention. This technique is used to make devices, systems, or processes to operate
automatically. The primary aim of automation is to boost the efficiency of business processes
and reduce/replace the human workforce.
This automaton consists of states and transitions. The State is represented by circles, and
the Transitions is represented by arrows.
Automata is the kind of machine which takes some string as input and this input goes through
a finite number of states and may enter in the final state.
• The term "Automata" is derived from the Greek word "αὐτόματα" which means
"selfacting".
• Finite automata are used in text processing, compilers, and hardware design.
Finite Automata
Types of Automata:
DFA: It refers to deterministic finite automata. Deterministic refers to the uniqueness of the
computation. In the DFA, the machine goes to one state only for a particular input character.
DFA does not accept the null move.
NFA: It is used to transmit any number of states for a particular input. It can accept the null
move.
• Some important points about DFA and NFA:
• Every DFA is NFA, but the converse need not be true i.e., every NFA need not be DFA.
• There can be multiple final states in both NFA and DFA.
• DFA is used in Lexical Analysis in Compiler.
• Construction of NFA is easier than the construction of DFA
• To test string is Accepted or not easier in DFA than in NFA
Solution:
Transition Diagram:
Transition Table:
→q0 q0 q1
q1 q2 q1
*q2 q2 q2
Example 2:
Solution:
Explanation:
o In the above diagram, we can see that on given 0 as input to DFA in state q0 the DFA
changes state to q1 and always go to final state q1 on starting input 0. It can accept 00,
01, 000, 001....etc. It can't accept any string which starts with 1, because it will never
go to final state on a string starting with 1.
Example 3:
Solution:
Explanation:
In the above diagram, we can see that on given 0 as input to DFA in state q0, the DFA
changes state to q1. It can accept any string which ends with 0 like 00, 10, 110, 100....etc. It
can't accept any string which ends with 1, because it will never go to the final state q1 on 1
input, so the string ending with 1, will not be accepted or will be rejected.
Examples of DFA
Example 1:
Design a FA with ∑ = {0, 1} accepts those string which starts with 1 and ends with 0.
Solution:
The FA will have a start state q0 from which only the edge with input 1 will go to the next
state.
In state q1, if we read 1, we will be in state q1, but if we read 0 at state q1, we will reach to
state q2 which is the final state. In state q2, if we read either 0 or 1, we will go to q2 state or
q1 state respectively. Note that if the input ends with 0, it will be in the final state.
Example 2:
Solution:
In the given solution, we can see that only input 101 will be accepted. Hence, for input 101,
there is no other path shown for other input.
Example 3:
Design FA with ∑ = {0, 1} accepts even number of 0's and even number of 1's.
Solution:
This FA will consider four different stages for input 0 and input 1. The stages could be:
Here q0 is a start state and the final state also. Note carefully that a symmetry of 0's and 1's is
maintained. We can associate meanings to each state as:
Example 4:
Design FA with ∑ = {0, 1} accepts the set of all strings with three consecutive 0's.
Solution:
The strings that will be generated for this particular languages are 000, 0001, 1000, 10001, ....
in which 0 always appears in a clump of 3. The transition graph is as follows:
Note that the sequence of triple zeros is maintained to reach the final state.
Example 5:
Design a DFA L(M) = {w | w ε {0, 1}*} and W is a string that does not contain consecutive
1's.
Solution:
The stages q0, q1, q2 are the final states. The DFA will generate the strings that do not
contain consecutive 1's like 10, 110, 101,..... etc.
Example 6:
Design a FA with ∑ = {0, 1} accepts the strings with an even number of 0's followed by
single 1.
Solution:
Example 2:
Solution:
Transition Table:
→q0 q1 ε
q1 ε q2
*q2 q2 q2
Example 3:
Solution:
Transition Table:
→q0 q1 q1
q1 q2 q2
*q2 ε ε
Examples of NFA
Example 1:
Present State 0 1
→q3 q3 q3
Solution:
The transition diagram can be drawn by using the mapping function as given in the table.
Here,K
Apple Watch & watchOS 7 Made Us Wash Our Hands Longer! ????
Example 2:
Design an NFA with ∑ = {0, 1} accepts all string ending with 01.
Solution:
Example 3:
Design an NFA with ∑ = {0, 1} in which double '1' is followed by double '0'.
Solution:
Then,
Now before double 1, there can be any string of 0 and 1. Similarly, after double 0, there can
be any string of 0 and 1.
1. q0 → q1 → q2 → q3 → q4 → q4 → q4 → q4
Example 4:
Solution:
The language consists of all the string containing substring 1010. The partial transition
diagram can be:
Now as 1010 could be the substring. Hence we will add the inputs 0's and 1's so that the
substring 1010 of the language can be maintained. Hence the NFA becomes:
Transition table for the above transition diagram can be given below:
Present State 0 1
→q1 q1 q1, q2
q2 q3
q3 q4
q4 q5
*q5 q5 q5
Got stuck! As there is no path from q2 for input symbol 0. We can process string 111010 in
another way.
As state q5 is the accept state. We get the complete scanned, and we reached to the final state.
Example 5:
Design an NFA with ∑ = {0, 1} accepts all string in which the third symbol from the right
end is always 0.
Solution:
Thus we get the third symbol from the right end as '0' always. The NFA can be:
The above image is an NFA because in state q0 with input 0, we can either go to state q0 or
q1.
Conversion from NFA to DFA
In this section, we will discuss the method of converting NFA to its equivalent DFA. In NFA,
when a specific input is given to the current state, the machine goes to multiple states. It can
have zero, one or more than one move on a given input symbol. On the other hand, in DFA,
when a specific input is given to the current state, the machine goes to only one state. DFA
has only one move on a given input symbol.
Let, M = (Q, ∑, δ, q0, F) is an NFA which accepts the language L(M). There should be
equivalent DFA denoted by M' = (Q', ∑', q0', δ', F') such that L(M) = L(M').
Step 2: Add q0 of NFA to Q'. Then find the transitions from this start state.
Step 3: In Q', find the possible set of states for each input symbol. If this set of states is not in
Q', then add it to Q'.
Step 4: In DFA, the final state will be all the states which contain F(final states of NFA)
Example 1:
Solution: For the given transition diagram we will first construct the transition table.
State 0 1
→q0 q0 q1
q1 {q1, q2} q1
*q2 q2 {q1, q2}
1. δ'([q0], 0) = [q0]
2. δ'([q0], 1) = [q1]
The δ' transition for state q1 is obtained as:
1. δ'([q2], 0) = [q2]
2. δ'([q2], 1) = [q1, q2]
The state [q1, q2] is the final state as well because it contains a final state q2. The transition
table for the constructed DFA will be:
State 0 1
Solution: For the given transition diagram we will first construct the transition table.
State 0 1
1. δ'([q1], 0) = ϕ
2. δ'([q1], 1) = [q0, q1]
Similarly,
State 0 1
Suppose
1. A = [q0]
2. B = [q1]
3. C = [q0, q1]
Minimization of DFA means reducing the number of states from given FA. Thus, we get the
FSM(finite state machine) with redundant states after minimizing the FSM.
We have to follow the various steps to minimize the DFA. These are as follows:
Step 1: Remove all the states that are unreachable from the initial state via any set of the
transition of DFA.
1. 1. δ (q, a) = p
2. 2. δ (r, a) = p
That means, find the two states which have the same value of a and b and remove one of
them.
Step 5: Repeat step 3 until we find no similar rows available in the transition table T1.
Step 7: Now combine the reduced T1 and T2 tables. The combined transition table is the
transition table of minimized DFA.
Example:
Solution:
Step 1: In the given DFA, q2 and q4 are the unreachable states so remove them.
Step 2: Draw the transition table for the rest of the states.
State 0 1
→q0 q1 q3
q1 q0 q3
*q3 q5 q5
*q5 q5 q5
Step 3: Now divide rows of transition table into two sets as:
1. One set contains those rows, which start from non-final states:
State 0 1
q0 q1 q3
q1 q0 q3
2. Another set contains those rows, which starts from final states.
State 0 1
q3 q5 q5
q5 q5 q5
Step 5: In set 2, row 1 and row 2 are similar since q3 and q5 transit to the same state on 0
and 1. So skip q5 and then replace q5 by q3 in the rest.
State 0 1
q3 q3 q3
State 0 1
→q0 q1 q3
q1 q0 q3
*q3 q3 q3
MOORE MACHINE:
• Moore machine is a finite state machine in which the next state is decided by the current
state and current input symbol. The output symbol at a given time depends only on the
present state of the machine. Def: Moore machine can be described by 6-tuple M=(Q, ∑ , Δ,
δ,q0, λ) where Q: finite set of states .
∑: finite set of input symbols
• Δ : output alphabet
• q0: initial state of machine
• δ: Q × ∑ → Q is a transition function
• λ: Q → Δ output function
Ex: Design a Moore machine to generate 1's complement of a given binary
number.
Solution: To generate 1's complement of a given binary number the simple logic is that if the
input is 0 then the output will be 1 and if the input is 1 then the output wil be 0. That means
there are three states. One state is start state. The second state is for taking 0's as input and
produces output as 1. The third state is for taking 1's as input and producing output as 0.
Ex: Design a Moore machine for a binary input sequence such that if it has a substring
101, the machine output A, if the input has substring 110, it outputs B otherwise it
outputs C.
Solution: For designing such a machine, we will check two conditions, and those are 101
and 110. If we get 101, the output will be A, and if we recognize 110, the output will be B.
For other strings, the output will be C.
The partial diagram will be:
Now we will insert the possibilities of 0's and 1's for each state. Thus the Moore
machine becomes:
Solution:
The transition table of given Moore machine is as follow.