You are on page 1of 28

Discrete Structure

Lecture 6
Class Conducted by
Bibek Ropakheti
Associate Professor : Cosmos College of Management and Technology
Visiting Faculty : NCIT
July 2020
Chapter 2
Finite State Automata
Chapter Outline
• Sequential Circuits and Finite state Machine
• Finite State Automata
• Language and Grammars
• Non-deterministic Finite State Automata
• Language and Automata
• Regular Expression
Today
• Sequential Circuits and Finite state Machine
• Finite State Automata
Background
• George Boole
• Boolean Algebra, Boolean Function, Boolean Expression
• Boole contributed in formalizing and mechanizing the process of
logical thinking
• Through his book “The Laws of Thought”, in 1854
• The development of a theory of logic using symbols instead of words
Background
• In 1938, C. E. Shannon observed that Boolean Algebra could be used
to analyze electrical circuits
• Boolean algebra became an indispensable tool for analysis and design
of electronic computers in succeeding era
• Concept of Combinatorial Circuits and Sequential Circuits
• Combinatorial circuit is uniquely defined for every combination of
inputs
• It doesn’t have memory, and previous state of the system do not
affect output of the circuit
Background
• Combinatorial Circuits can be constructed using solid state devices
called gates
• Gates are capable of switching voltage levels or bits
• But real solutions demands that output depends not only on inputs
but also on the state of the system at the time of input
Introduction
• Circuits for which the output is a function, not only of the inputs but
also of the state of the system, are called sequential circuits
• The state of the system is determined by previous processing
• Thus these systems have memory
• They are important in computer design
• Finite state machines are abstract models of machines with a
primitive internal memory
Sequential Circuits
• Operations within a digital computer are carried out at discrete
intervals of time.
• Output depends on the state of the system as well as on the input.
• It is assumed that the state of the system changes only at discrete
interval of time, i.e. t = 0, 1, . . . .
• A simple way to introduce sequencing in circuits is to introduce a unit
time delay.
Sequential Circuits
• unit time delay accepts as input
a bit xt at time t and outputs xt−1,
the bit received as input at time
t−1
Sequential Circuits: Example
• Use of delay in serial adder
• A serial adder takes two binary
numbers as input
• a= an-1 an-2 … a1 a0
• b= bn-1 bn-2 … b1 b0
• And outputs the sum of a and b, as
s= sn sn-1 … s1 s0
• The numbers a and b are input
sequentially in pairs and the sum s
is the output
Finite State Machine
• A finite state machine is an abstract model of a machine with a
primitive internal memory
• A finite-state machine M consists of
(a) A finite set I of input symbols
(b) A finite set O of output symbols
(c) A finite set S of states
(d) A next-state function f from S × I into S
(e) An output function g from S × I into O
(f) An initial state σ ∈ S
Written as, M = (I, O, S, f , g, σ)
Finite State Machine: Example
• Let M be a finite machine with g given by,
I = {a, b}, g(σ0, a) = 0
O = {0, 1}, g(σ0, b) = 1
S = {σ0, σ1}, g(σ1, a) = 1
f given by, g(σ1, b) = 0
f(σ0, a) = σ0 and, σ = σ0
f(σ0, b) = σ1
f(σ1, a) = σ1
f(σ1, b) = σ1
Finite State Machine: Example
• Its transition table is given as,
f g
S/I a b a b
àσ0 σ0 σ1 0 1
σ1 σ1 σ1 1 0

• And its transition diagram is,


Transition Diagram
• Transition diagram for a finite state machine is a diagraph G whose
vertices are the members of S
• An arrow designates the initial state σ
• A directed edge (σ1, σ2) exists in G
if there exists an input i with f(σ1,i)= σ2
• In this case, if g(σ1,i)= o the edge is labelled i/o
Finite State Machine: Example
• Now let us find the output string Initial Input Output Output
and output state for the input State State
string aababba in the σ0 a σ0 0
aforementioned example σ0 a σ0 0
σ0 b σ1 1
• Hence, the output state is σ1 and σ1 a σ1 1
the output string is 0011001 σ1 b σ1 0
σ1 b σ1 0
σ1 a σ1 1
Practice
• Draw the transition diagram of the f g
finite state machine M, where, S/I a b a b
I = {a, b}
O = {0, 1} P Q Q 0 1
S = {P, Q, R} Q R Q 1 1
σ = P and R P P 0 0
transition given by,

• Also find the output state and


output string for the given input
string: aabbaba
Practice
• Find the sets I, O and S, the
initial state and the table
defining the next state and
output functions for given
diagram of finite state machine
Exercise
• Discrete Mathematics by R. Johnsonbaugh
• Page number 572
• Review Questions 1-4
• Exercise Questions
1-16
Finite State Automata
• A finite state automata is a special kind of finite state machine
• These are of special interest because of their relationship to the
languages
• An FSA, X consists of
1. A finite set I of input symbols
2. A finite set S of states
3. A next-state function f from S × I into S
4. A subset A of S of accepting states
5. An initial state σ ∈ S.
Written as, X = (I, S, f , A, σ ).
Example
f
• The transition diagram of the S/I a b
finite-state automaton A = (I, S, f àσ0 σ0 σ1
, A, σ ), where,
σ1 σ0 σ2
I = {a, b}, S = {σ0, σ1, σ2}, *σ2 σ0 σ2
A= {σ2}, σ = σ0,
and f is given by the
following table
Finite State Automata
• If a string is input to a FSA, we will end at either an accepting or a non
accepting state
• The status of this final state determines whether the string is
accepted by the FSA or not
Few Terminologies in Automata
• Alphabet: Collection of input symbol. Example: Binary alphabet {1,0}
• String: Any occurrence of input symbols. Example: 0, 1, 10, 1111
• Empty String: Zero occurrence of input symbols representing 𝛆 or 𝛌
• Language: Collection of all possible strings formed from the given
input alphabet. Example: 1:anbn : n>0
{0, 1, 00, 01, 10, 11, ……}
• Closure of an alphabet/language: Collection of all the possible strings
formed from the given input alphabet including the empty string.
Represented by A*
Accepting an string
• Let A = (I, S, f , A, σ ) be a finite- • We let Ac(A) denote the set of
state automaton. strings accepted by A and we say
• Let α = x1 ···xn be a string over I. that A accepts Ac(A).
• If there exist states σ0,...,σn • Let α=x1···xn be a string over I.
satisfying • Define states σ0,...,σn by
(a) σ0 =σ conditions(a)and (b) above.
(b) f(σi−1,xi) = σi for i = 1,...,n • We call the (directed) path
(c) σn ∈ A, (σ0 , . . . , σn) the path representing
• We say that α is accepted by A. α in A.
• The null string is accepted if and
only if σ ∈ A.
Example:
• Check whether the previously • Then does it accept abaabb.
mentioned FSA accepts abbab
Reference Books
• Keneth Rosen, Discrete Mathematical Structures with Applications to
Computer Science, WCB/ McGraw Hill
• G. Birkhoff, T.C. Bartee, Modern Applied Algebra, CBS Publishers.
• R. Johnsonbaugh, Discrete Mathematics, Prentice Hall Inc.
• G.Chartand, B.R.Oller Mann, Applied and Algorithmic Graph Theory,
McGraw Hill
• Joe L. Mott, Abrahan Kandel, and Theodore P. Baker, Discrete
Mathematics for Computer Scientists and Mathematicians, Prentice-
Hall of India
Let us Discuss
Any Issues?
Thank You

You might also like