Finite Automata

Finite Automata
What is Finite Automata?
• mathematical model of a digital computer.
• It is used to recognize patterns within input taken
from some alphabet set.
• It consists of discrete inputs and outputs.
• Input given to a machine is processed by various
states. These states are called as intermediate
states.
• The job of FA is to accept or reject an input
depending on whether the pattern defined by the
FA occurs in the input.
Finite Automaton Model
Input tape
It is a linear tape which holds the input string. The tape is divided into a finite number of cells. Each
cell holds a symbol from Ʃ.
Finite Control
It Indicates current state and decides next state on receiving a particular input from input tape. It
consists of 3 things:
•
finite number of states that the machine is allowed to be in (zero or more states are designated as accept or
final states),
•
a current state, initially set to a start state,
•
a state transition functions for changing the current state.
Storage
Automaton have temporary storage which has unlimited number of cells
Control Head (or) Tape Head
It reads symbol from input tape and moves right side with or without changing the state.
Definition
Finite Automata is a collection of 5- tuples
M=(Q , Σ , δ , q0 , F)
where
Q - Finite set of states
Σ - Finite set of Input symbols
δ - Transition Function
i.e., Q Χ Σ → Q
q0 - Initial State
F - Final State
Transition Diagram
• directed graph for finite automata
• If there is transition from state ‘p’ to state ‘q’ on
input ‘a’, then there is an arc labeled ‘a’ from
state ‘p’ to state ‘q’ in the transition diagram.
Example:
‘Initial state’ is represented as
Accepting states are represented by double circles
Problems
1.Design FA which accepts the only input 101
over the input set Ʃ={0.1}
Solution:
The language accepts only string 101
So L (M)={101}
Design FA which checks whether given binary
number is even.
Solution:
A binary number is even if it ends in 0 else the
number is odd.
Binary even number 2 = 10, 4 = 100, 6 = 110, ……
Binary odd number 1=1, 3 = 11, 5 = 101, 7= 111
Design FA which accepts only those strings
which start with 1 and ends with 0.
Solution:
Possible strings in the language are
L (M) = {10,110,1010,100,10110,………………..}
Design FA which accepts odd number of 1’s and
any number of 0’s.
Solution:
The strings are
L (M) = {10,1110,10000,10101,…………}
Design FA which checks whether the given unary number
is divisible by 3.
Solution:
Given that automata has only unary number so Ʃ = {1}.
Number should be divisible by 3 so automata accept
number of 1’s in multiples of 3.
Strings are L (M) = {111, 111111, 111111111, …………….}
Design FA which checks whether the given binary number is
divisible by 3.
Solution:
Given that automata with binary numbers so Ʃ = {0,1}
If a number is divisible by 3, the possible remainders are 0, 1, 2. If
remainder is 0, then the number is divisible by 3.
Consider state q0 as strings with remainder 0 (e.g., 0, 110,
1001,…….)
q1 as strings with remainder 1 (e.g., 1, 100, 111,………)
q2 as strings with remainder 2 ( e.g., 10, 101, 1000,……)
Design FA which accepts even number of 0’s and
even number of 1’s.
Solution:
Strings are
L (M) = {1100, 1010, 0011, 101101, ……………….}
Number of 0’s and 1’s will be same. q0 acts both as
initial and final state
Design FA to accept the string that always ends
with 00.
Solution:
A string always ends with 00. Therefore, possible
strings are {00, 100, 10100, 1100, …….}
Design FA which accepts set of integers.
Solution:
An integer consists of only numbers from 0 to 9.
Design FA for recognizing identifiers.
Solution:
An Identifier should start with letters followed
by letters or digits
L (M) = {(letter and letter/digit)*}