TOC UNIT I.1
TOC UNIT I.1
UNIT-I
FINITE AUTOMATA
UNIT-I
FINITE AUTOMATA
The following table highlights the key developments during the evolution of
Automata Theory −
From the decades of 1930s and 1940s the development of automata theory was
formulated, but it becomes much more advanced in 50s to 60s decade. Here we have
started to understand and manipulate the complexity of languages used in
computation.
In the latter half of the 20th century, there were many such theoretical advancements
and practical applications in various computing fields associated with automata theory
or the theory of computation.
All the newer technologies are being used are relying on the same fundamental
computing and AI, machine learning, bioinformatics, and quantum computing. It
helps design intelligent agents capable of navigating complex environments, analyze
the complexity of learning algorithms, and design efficient models for tasks like
pattern recognition and sequence analysis.
Compiler Design −Analyzing code syntax using finite automata and regular
expressions.
Natural Language Processing (NLP) −Automata theory is being used to understand
and manipulate human language.
Contributions to Advanced Fields −
1. Creating intelligent agents capable of navigating complex environments
2. Analyzes learning algorithm complexity, and creates efficient models for tasks
like pattern recognition and sequence analysis.
In NLP, there is a concept called Morphology which is the study of the structure and
pattern of word formation, with morphemes being the basic units that contain
meaning.
Automata theory has big role to play in programming languages and their translators,
namely the compilers and interpreters.
We explained the applications of Automata in broad spectrum, but Automata finds its
role in fairly simple real-word applications as well −
Theory of Automata
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.
Symbols:
Symbols are an entity or individual objects, which can be any letter, alphabet or any
picture.
Example:
1, a, b, #
Alphabets:
∑ = {a, b}
∑ = {A, B, C, D}
∑ = {0, 1, 2}
∑ = {0, 1, ....., 5]
∑ = {#, β, Δ}
String:
Example 1:
If ∑ = {a, b}, various string that can be generated from ∑ are {ab, aa, aaa, bb, bbb, ba,
aba.....}.
Example 2:
. w = 010
.
. Number of Sting |w| = 3
Introduction to languages
Language:
Example: 1
Example: 2
L2 = {Set of all strings starts with 'a'}
KLEEN CLOSURES
Kleene Closure, also known as the Kleene Star, is a fundamental concept in the
Theory of Computation (TOC). It is a unary operation on a set of symbols or strings
that results in the infinite set of all possible strings of all possible lengths over the
given set, including the empty string (λ).
Kleene Closure (*) gives an infinite set of all possible strings of any length,
including epsilon (ε), over input values of sigma (Σ). It is also known as Kleene
Star and denoted by Σ*. The following is a mathematical notation of Kleene
Clouser.
Σ* = Σ0 U Σ1 U Σ2 ………. .
Example: Suppose Σ input value is “(0,1)”, applying Kleene Closure (*) over Σ
input which gives the following result
Result (0,1)* will give all possible combinations of “0” and “1” of any length,
including epsilon (ε). So, we can say Kleene Closure always gives infinite
language.
The following are various examples of Kleene Closure over input values of sigma (Σ).
∅* = {ε}
{x, y, z}* = { ε, x, y, z, xx, xy, xz, yx, yy, yz, za, zb, zz, xxx, xxy, …………}.
{01,0}* = {ε, “01”, “0”, “0101”, “010”, “001”, “00”, “010101”, “01010”, “01001”,
“0100”, “00101”, “0010”, “0001”, “000”, …}
{a*bc*} = {a*+b+ c*} = {b, ab, aabcc, ………… n} // where “b” is compulsory in
each string
Positive Closure
Positive Closure is similar to Keleene Closure except epsilon (ε). It also gives an
infinite set of all possible strings of any length, excluding epsilon (ε) over input
values of sigma (Σ). Σ+ denotes it. The following is the mathematical notation of
Positive Closure.
Σ+ = Σ*– {ε}
Suppose Σ input value is “(0,1)”, applying Positive Closure (+) over Σ input which
gives the following result
Result (0,1)+ will give all possible combinations of “0” and “1” of any
length excluding epsilon (ε). So, we can say Positive Closure always gives infinite
language.
All examples of positive Closure are similar to Kleene closure except epsilon (ε). The
following are the various examples of Positive Closure over sigma (Σ) input values.
Example 01: Kleene Closure applied to an empty set, the result is an empty set
∅+ = {}
{a}+ = {a, aa, aaa, aaaa, …………….} // all combination of “a” with any length
Σ* contains the epsilon (ε) sting along with other N strings, but Σ+ is just like the
Σ* but does not hold the epsilon (ε) sting.
So, Σ* holds the identity(single) element called Absalon, but Σ+ does not have the
identity element called epsilon (ε)
Σ* is a Universal Set.
Finite Automata(FA)
The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-
acting". An automaton (Automata in plural) is an abstract self-propelled computing
device which follows a predetermined sequence of operations automatically.
Formal Definition of FA
Input tape: It is a linear tape having some number of cells. Each input symbol is
placed in each cell.
Finite control: The finite control decides the next state on receiving particular input
from input tape. The tape reader reads the cells one by one from left to right, and at a
time only one input symbol is read.
Types of Automata:
2. NFA
NFA stands for non-deterministic finite automata. It is used to transmit any number of
states for a particular input. It can accept the null move.
Transition Graph
1. In DFA, the input to the automata can be any string. Now, put a pointer to the start
state q and read the input string w from left to right and move the pointer according to
the transition function, δ. We can read one symbol at a time. If the next symbol of
string w is a and the pointer is on state p, move the pointer to δ(p, a). When the end of
the input string w is encountered, then the pointer is on some state F.
2. The string w is said to be accepted by the DFA if r ∈ F that means the input string
w is processed successfully and the automata reached its final state. The string is said
to be rejected by DFA if r ∉ F.
Example 1:
Solution:
The finite automata can be represented using a transition graph. In the above diagram,
the machine initially is in start state q0 then on receiving input 1 the machine changes
its state to q1. From q0 on receiving 0, the machine changes its state to q2, which is
the dead state. From q1 on receiving input 0, 1 the machine changes its state to q1,
which is the final state. The possible input strings that can be generated are 10, 11,
110, 101, 111......., that means all string starts with 1.
Example 2:
Solution:
The NFA can be represented using a transition graph. In the above diagram, the
machine initially is in start state q0 then on receiving input 1 the machine changes its
state to q1. From q1 on receiving input 0, 1 the machine changes its state to q1. The
possible input string that can be generated is 10, 11, 110, 101, 111......, that means all
string starts with 1.
Transition Table
A transition table is a tabular representation of the transition function that takes two
arguments and returns a state. The column contains the state in which the automaton
will be on the input represented by that column. The row corresponds to the state the
finite control unit can be in. The entry for one row corresponding to state q and the
column corresponds to input a is the state δ(q, a).
Example 1:
Solution:
Transition table of given DFA is as follows:
o In the above table, the first column indicates all the current states. Under
column 0 and 1, the next states are shown.
o The first row of the transition table can be read as, when the current state is q0,
on input 0 the next state will be q1 and on input 1 the next state will be q2.
o In the second row, when the current state is q1, on input 0, the next state will
be q0, and on 1 input the next state will be q2.
o In the third row, when the current state is q2 on input 0, the next state will be
q2, and on 1 input the next state will be q2.
o The arrow marked to q0 indicates that it is a start state and circle marked to q2
indicates that it is a final state.
Example 2:
Solution:
o The first row of the transition table can be read as, when the current state is q0,
on input 0 the next state will be q0 and on input 1 the next state will be q1.
o In the second row, when the current state is q1, on input 0 the next state will
be either q1 or q2, and on 1 input the next state will be q2.
o In the third row, when the current state is q2 on input 0, the next state will be
q1, and on 1 input the next state will be q3.
o In the fourth row, when the current state is q3 on input 0, the next state will be
q2, and on 1 input the next state will be q2.
For the transition graph in the above figure the transition table would be as follows:
states a b
q0 q1 q2
q1 q1 q3
q2 q2 q3
*q3 q3 q3
In the above table we observe that on giving a as input to DFA in state q0 the DFA
changes state to q1 and on input b the state changes to q2. Similarly by writing this
information for other states we generate the transition graph.
In DFA, for each input symbol, one can determine the state to which the machine will
move. Hence, it is called Deterministic Automaton. As it has a finite number of
states, the machine is called Deterministic Finite Machine or Deterministic Finite
Automaton.
1.Deterministic Transitions: For every state and every input symbol, there is exactly one
transition to a next state.
2.Finite States: A DFA has a finite number of states that define its possible
configurations.
3.Single Start State: The DFA begins processing from a specific initial state.
4.Acceptance Condition: A DFA accepts an input string if, after processing all input
symbols, it ends in one of its accept states.
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:
Example 6:
Design a FA with ∑ = {0, 1} accepts the strings with an even number of 0's followed
by single 1.
Solution:
Let’s create a DFA to recognize binary strings containing the substring ‘101’.