0% found this document useful (0 votes)
13 views19 pages

Lec 02 - Finite Automata

This document discusses finite state machines (FSM), including: 1. FSMs can change between a finite number of states in response to inputs, with each change called a transition. 2. Practical examples of FSMs include vending machines, elevators, and traffic lights. 3. A FSM is mathematically defined by its set of states, inputs, transition function, initial state, and final states. 4. Deterministic and non-deterministic finite automata are discussed as types of FSMs without outputs, along with examples of constructing state diagrams for each.

Uploaded by

Sathya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views19 pages

Lec 02 - Finite Automata

This document discusses finite state machines (FSM), including: 1. FSMs can change between a finite number of states in response to inputs, with each change called a transition. 2. Practical examples of FSMs include vending machines, elevators, and traffic lights. 3. A FSM is mathematically defined by its set of states, inputs, transition function, initial state, and final states. 4. Deterministic and non-deterministic finite automata are discussed as types of FSMs without outputs, along with examples of constructing state diagrams for each.

Uploaded by

Sathya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

IS2402: INDUSTRIAL STATISTICS AND MODELLING

COMPUTATION

Section 03: Modelling Computation

Finite State Automata (Finite State Machines)

Prepared by Ms. WE Iroshani


Lecture (Probationary)
Division of Interdisciplinary studies

18/10/2023 1
Finite State Machines/ Finite State Automation
➢A finite-state machine (FSM), finite-state automaton(FSA), finite
automaton, or simply a state machine, is a mathematical model of
computation.
➢The FSM can change from one state to another in response to some inputs;
the change from one state to another is called a transition.

18/10/2023 2
Simple Examples to demonstrate FSA

02

18/10/2023 3
Practical Examples of the Uses of FSA/ FSM
➢The behavior of state machines can be observed in many devices in modern society
that perform a predetermined sequence of actions depending on a sequence of events
with which they are presented. Simple examples are;
❑ Vending machines (which dispense products when the proper combination of
coins is deposited)
❑ Elevators (whose sequence of stops is determined by the floors requested by
riders)
❑ Traffic lights (which change sequence when cars are waiting)
❑ Combination locks (which require the input of a sequence of numbers in the
proper order)

18/10/2023 4
Practical Examples of the Uses of FSA/ FSM:
Traffic Lights

FSM consists of:


❖ Discrete number of
states
❖ Changes of state are
triggered by
transitions
❖ Can only exist in
one state at a time.
18/10/2023 5
Finite State Machines - Concept and Terminology
➢The finite-state machine has less computational power than some other models of
computation such as the Turing machine.
➢The computational power distinction means there are computational tasks that a
Turing machine can do but an FSM cannot.
➢This is because an FSM's memory is limited by the number of states it has.
➢Mathematical Model of a Finite State Machine is defined as

𝑀 = (𝑆, 𝐼, 𝑓, 𝑠0 , 𝐹)
Where;
𝑆 = Set of all states, 𝐼 = Set of Inputs 𝑓 = Transition function
𝑠0 = Initial State / start 𝐹 = Final State

18/10/2023 6
Finite State Machines - Concept and Terminology
Example 2.1:

18/10/2023 7
III IV I II

18/10/2023 8
(I) Deterministic Finite Automata (Finite State machines without output)
➢DFA is a finite automata, in which for each input symbols, there is only one
transitions for each state.
➢The mathematical model is 𝑀 = (𝑆, 𝐼, 𝑓, 𝑠0 , 𝐹)
Example 2.2 Let a deterministic finite automation be 𝑆 = {𝑎, 𝑏, 𝑐}, 𝐼 = 0,1 , 𝑠0 = {𝑎},
𝐹 = {𝑐} and the transition function (𝑓) as shown by the following table. Construct the
state diagram

Present State Next state for input 0 Next state for input 1
a a b
b c a
c b c

18/10/2023 9
(I) Deterministic Finite Automata (Finite State machines without output)
Example 2.3
Construct the state diagram for the following situation,
𝑀 = 𝑆𝑒𝑡 𝑜𝑓 𝑠𝑡𝑟𝑖𝑛𝑔𝑠 𝑡ℎ𝑎𝑡 𝑠𝑡𝑎𝑟𝑡 𝑤𝑖𝑡ℎ 0
M={……………………………………………}

Example 2.4
Construct a state diagram to represent the set of bit strings that begin with two 0’s.
M={…………………………………………….}

18/10/2023 10
(I) Deterministic Finite Automata (Finite State machines without output)
Example 2.5
Construct a state diagram to represent the set of bit strings that do not contain two
consecutive 0s.

Example 2.6
Construct a state diagram to represent the set of bit strings that end with two 0s

Example 2.7
Construct a state diagram to represent the set of bit strings that contain at least two
0s

18/10/2023 11
(II) Non Deterministic Finite Automata (Finite State machines without
output)

➢Some moves of the machine cannot be determined uniquely by the input symbol and the
present state of such machines are called non deterministic automata.

➢In NDFA, for a particular input symbol, the machine can move to any combination of
the state in the machine.

18/10/2023 12
(II) Non Deterministic Finite Automata (Finite State machines without
output)

Example 2.8

Let a non-deterministic finite automaton be 𝑆 = {𝑎, 𝑏, 𝑐}, 𝐼 = {0,1}, 𝑠0 = 𝑎 , 𝐹 = {𝑐}


then transition function (𝑓) as shown below. Construct the state diagram.

Present State Next state for input 0 Next state for input 1
a a, b b
b C a,c
c b, c c

18/10/2023 13
(II) Non Deterministic Finite Automata (Finite State machines without
output)

Example 2.9

Construct the transition function 𝑓 considering the non-deterministic automata which is


given below.

18/10/2023 14
(II) Non Deterministic Finite Automata (Finite State machines without
output)

Example 2.10

Design a NFA for the language L, all the strings over {0,1} that have atleast two
consecutive 0’s or 1’s

Exercise: Find out what are the differences between DFA and NFA and prepare a table

18/10/2023 15
Finite State machines with output (Moore Machines and Mealy Machines)

18/10/2023 16
Finite State machines with output - Moore Machines

18/10/2023 17
Finite State machines with output - Moore Machines
Example 2.11
Construct a Moore machines that counts the occurrence of ‘abb’ in any input string over
{a ,b }

18/10/2023 18
Finite State machines with output - Mealy Machines

18/10/2023 19

You might also like