UNIT 1 TOC Sem5 RGPV

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

UNIT 1

Automata

The term “Automata” is derived from the Greek word ““αὐτόματα”” which means “self-
“self
acting”. An automata is an abstract computing device (or machine). There are different
varities of such abstract machines (also called models of computation) which can be
defined mathematically. Some of them are as powerful in principle as today's real
computers, while the simpler ones are less powerful.

The main motivation behind developing the automata theory was to develop methods to
describe and analyse thee dynamic behaviour of discrete systems.
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.

An automaton with a finite number of states is called a Finite Automaton (FA) or Finite
State Machine (FSM).

Example of Automata:

 Sequential machine: A sequential machine is a mathematical model of a


certain type of simple computational structure. Its behavior represents the
working process of finite Auotmata.
 Vending Machines: A vending machine is an automated machine that
dispenses numerous items such as cold drinks, snacks, b
beverages,
everages, alcohol etc.
to sales automatically, after a buyer inserts currency or credit into the machine.

1|Page
 Traffic Lights: The optimization of traffic light controllers in a city is a
systematic representation of handling the instructions of traffic rules. Its
process depends on a set of instruction works in a loop with switching among
instruction to control traffic.
 Video Games: Video games levels represent the states of automata. In which a
sequence of instructions are followed by the players to accomplish the task.

 Text Parsing: Text parsing is a technique which is used to derive a text string
using the production rules of a grammar to check the acceptability of a string.

 Regular Expression Matching: It is a technique to checking the two or more


regular expression are similar to each other or not. The finite state machine is
useful to checking out that the expressions are acceptable or not by a machine
or not.

 Speech Recognition: Speech recognition via machine is the technology


enhancement that is capable to identify words and phrases in spoken
language and convert them to a machine-readable format.

Finite Automata
Finite automata are used to recognize patterns. It takes the string of symbol as input and
changes its state accordingly. When the desired symbol is found, then the transition
occurs. At the time of transition, the automata can either move to the next state or stay in
the same state. Finite automata have two states, Accept state or Reject state. When the
input string is processed successfully, and the automata reached its final state, then it will
accept.

Related Terminologies

Alphabet

 Definition − An alphabet is any finite set of symbols.

 Example − ∑ = {a, b, c, d} is an alphabet set where ‘a’, ‘b’, ‘c’, and ‘d’ are symbols.

2|Page
String

 Definition − A string is a finite sequence of symbols taken from ∑.

 Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d}

Length of a String

 Definition − It is the number of symbols present in a string. (Denoted by |S|).

 Examples −

 If S = ‘cabcad’, |S|= 6

 If |S|= 0, it is called an empty string (Denoted by λ or ε)

Language

 Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or


infinite.

 Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L
= { ab, bb, ba, bb}

Formal definition of a Finite Automaton

An automaton can be represented by a 5-tuple (Q, ∑, δ, q0, F), where −

 Q is a finite set of states.


 ∑ is a finite set of symbols, called the alphabet of the automaton.
 δ is the transition function.
 q0 is the initial state from where any input is processed (q0 ∈ Q).
 F is a set of final state/states of Q (F ⊆ Q).

Types of Automata:

3|Page
There are two types of finite automata:

1. DFA(deterministic finite automata)


2. NFA(non-deterministic
deterministic finite automata)

1. DFA

In DFA, for each input symbol, one can determine the state to which the machine will move.
Hence, it is called Deterministic Automaton
Automaton.. As it has a finite number of states, the
machine is called Deterministic Finite Machine or Deterministic tic Finite Automaton.

Formal Definition of a DFA

A Deterministic Finite State Automaton (DFA) is a 5-tuple : (Q, ∑, δ,, q0, F)

 Q is a finite set of states.

 ∑ is a finite set of symbols called the alphabet.

 δ is the transition function where δ: Q × ∑ → Q

 q0 is the initial state from where any input is processed (q0 ∈ Q).

 F is a set of final state/states of Q (F ⊆ Q).

4|Page
2. NFA

In NDFA, for a particular input symbol, the machine can move to any combination of the
states in the machine. In other words, the exact state to which the machine moves cannot
be determined. Hence, it is called Non-deterministic Automaton. As it has finite number
of states, the machine is called Non-deterministic Finite Machine or Non-deterministic
Finite Automaton.

Formal Definition of an NDFA

An NDFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −

 Q is a finite set of states.

 ∑ is a finite set of symbols called the alphabets.

 δ is the transition function where δ: Q × ∑ → 2Q

 (Here the power set of Q (2Q) has been taken because in case of NDFA, from a state,
transition can occur to any combination of Q states)

 q0 is the initial state from where any input is processed (q0 ∈ Q).

 F is a set of final state/states of Q (F ⊆ Q).

Finite Automata as a language acceptor and translator

Problem :- Draw a DFA for the language accepting strings ending with ‘abba’ over
input alphabets ∑ = {a, b}
Solution-

Regular expression for the given language = (a + b)*abba


Step-01:

 All strings of the language ends with substring “abba”.


 So, length of substring = 4.

5|Page
Thus, Minimum number of states required in the DFA = 4 + 1 = 5.
It suggests that minimized DFA will have 5 states.

Step-02:
We will construct DFA for the following strings
strings-
 abba
 aabba
 ababba
 abbabba
 abbaabba

Step-03:
The required DFA is-

Mealy and Moore Machines


Moore Machines: Moore machines are finite state machines with output value and its o
utput depends only on present state. It can be defined as (Q, q0, ∑, O, δ,
δ λ) where:
 Q is finite set of states.
 q0 is the initial state.
 ∑ is the input alphabet.
 O is the output alphabet.
 δ is transition function which maps Q×∑ → Q.
 λ is the output function which maps Q → O.

6|Page
Mealy Machines: Mealy machines are also finite state machines with output value and
its output depends on present state and current input symbol. It can be defined as
(Q, q0, ∑, O, δ, λ’) where:

 Q is finite set of states.


 q0 is the initial state.
 ∑ is the input alphabet.
 O is the output alphabet.
 δ is transition function which maps Q×∑ → Q.
 ‘λ’ is the output function which maps Q×∑→ O.

7|Page
Difference between Mealy machine and Moore machine

S.no Moore Machine Mealy Machine


Output depends on present state as well as
Output depends only upon
1 present input.
present state.

If input changes, output does


2 If input changes, output also changes.
not change.
More number of states are
3 Less number of states are required.
required.
There is more hardware
4 There is less hardware requirement.
requirement.
They react slower to
5 They react faster to inputs.
inputs(One clock cycle later)
Synchronous output and state
7 Asynchronous output generation.
generation.
8 Output is placed on states. Output is placed on transitions.
9 Easy to design. It is difficult to design.

Conversion from Mealy to Moore and vice versa.


Example 1:

Convert the following Mealy machine into equivalent Moore machine.

Solution:

Transition table for above Mealy machine is as follows:

8|Page
o For state q1, there is only one incident edge with output 0. So, we don't need to
split this state in Moore machine.
o For state q2, there is 2 incident edge with output 0 and 1. So, we will split this state
into two states q20( state with output 0) and q21(with output 1).
o For state q3, there is 2 incident edge with output 0 and 1. So, we will split this state
into two states q30( state with output 0) and q31( state with output 1).
o For state q4, there is only one incident edge with output 0. So, we don't need to
split this state in Moore machine.

Transition table for Moore machine will be:

9|Page
Transition diagram for Moore machine will be:

Example 2:

Convert the following Mealy machine into equivalent Moore machine.

Solution:

Transition table for above Mealy machine is as follows:

10 | P a g e
The state q1 has only one output. The state q2 and q3 have both output 0 and 1. So we
will create two states for these states. For q2, two states will be q20(with output 0) and
q21(with output 1). Similarly, for q3 two states will be q30(with output 0) and q31(with
output 1).

Transition table for Moore machine will be:

Transition diagram for Moore machine will be:

11 | P a g e
We hope you find these notes useful.
useful
Contribute study material and get list
listed on Hall of Fame and win
cash prize every week.
 50 Points : Contributing Per Video.
 50 Points : Contributing Per Page Notes Hand Written/ Typed.
 50* Points : Contributing Project(If Project is Large then more Points
will be issued).
 50 Points : Contributing Other material
NOTE:- Points will be issued only if the material provided by you is approved.
approved

If you have any queries or you want to submit your study notes
please write us at
[email protected]
or
[email protected]
And Fill this form
FORM

You might also like