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

UNIT I - Introduction to Finite Automata

Basappa B. Kodada
Asst. Professor, Dept. of CSE

CANARA ENGINEERING COLLEGE

August 10, 2015

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Outlines

1. What do you mean FLAT?


2. Why it is called Theory of Computation?
3. Why do we need to study?
4. Definition of Finite Automata
5. Mathematical Background (Set Theory, Inductions, Graphs
and Trees)
6. Central Concept of Finite Automata
7. Deterministic Finite State Automata
8. Non-Deterministic Finite State Automata
9. Applications of Finite Automata

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
What do you mean by FLAT?

It is very important and is a heart process of computation


techniques in Computer science subjects
It is a automatic process of the internal operations/process of
the CPU
Since the computer hardware understands or accepts only
Binary Bits 0’s and 1’s
So Automata will tell you to design an automated machine
which will process/accept/rejects the the binary bits
automatically.
We require a set of rules or protocols, set of structures to
design it. Hence the Formal Language is communication
media which provides the set of protocols to generate the set
of instruction which will be understand by the Machines.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Why is it called as Theory of Computation?

This subject is called ”Theory of Computation” because it


includes rules for constructing a computer language and
converts into machine format; i.e. the theory of computer
science. Basically formal language and automata theory and
theory of computation are different names for a single subject
that covers all the aspects of the theoretical part of Computer
Science.
Automata theory is the study of abstract computing devices,
or ”machines. Long years before Turing studied an abstract
machine that had all the capabilities of today’s computers, at
least, as far as in what they could compute. Turing’s goal was
to describe the boundary between computing machines which
decides what they could do and what it could not do. Finally
his conclusions apply not only to his abstract Turing machine,
but also today’s real machines or abstract machine or finite
automata machine.
Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Why do we need to Study this Subject?

Software is used to designing, checking the behavior of digital


circuits and scanning large bodies of text in the web pages to
find the occurrences of words.
The ”lexical analyzer” is a typical compiler, that breaks the
input text into logical units or tokens, such as identifiers,
keywords etc.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Definition of Finite Automata

Definition: Finite Automata is abstract computing device which


receives the inputs and gives the required output in terms of
whether the input is accepted or rejected. This finite automata
consist of number of states which are used to remember the status
of the machine. So each states are called as storages states.
Example: If you consider the example of TV or Computer or any
electronic device will have only two states (on and off).

push
off on
push

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Mathematical Background - Basic Set Theory

Union, Intersection, Concatenation, Difference, Cross Product


and Complement set
Laws: Commutative, Associative, Distributive, De Margans
Law and other Laws like A − B = A ∩ B

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Mathematical Background - Induction Hypothesis

1. The statement or formula is true for some value n, usually


n=1
2. If the statement or formula is also true for some value of n,
say k, then it is also true for k + 1
Mathematical Induction allow us to prove equations for arbitrary n
by having the following properties
1. Base Case: The number 1 has the property of Mathematical
Induction(MI), i.e. we have a proof of MI (1) is true, then it
will also true for n, i.e MI (n) is true.
2. Induction: If n is number which we have assumed to have
property MI (n), then we can prove that n + 1 also has the
property MI (n + 1).

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Mathematical Background - Graphs and Trees
e1 a
P Q P Q

e2 e3 b c
e4 d
R S e5 R S e
a
P Q

b c
d
R S e
S

a A b c

a b c d
Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata

Symbols
Alphabets
Strings
The Problems

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Symbols

A symbol is a one of the following finite sequences of ASCII


characters:
One of the digits 0-9.
One of the upper case letters A - Z;
One of the lower case letters a - z;

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Alphabets are the finite subset of symbols is defined in the above


section. That
Pmeans it is a non-empty set of symbols. It is
denoted by .
Example:
P
= {0, 1, a − z, A − Zetc}

Power of an Alphabet:
P It can be defined
Pi as set of all possible
length of i over and it is denoted
P by
Example:
P0 if the input alphabet is = {0, 1} then
P1 = {ǫ}
P2 = {0, 1}
P3 = {00, 01, 10, 11}
= {000, 001, 010, 011, 100, 101, 110, 111} ...etc.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P∗ P0 P1 P2 P3
= ∪ ∪ ∪ ∪......
P∗
= {ǫ}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P∗ P0 P1 P2 P3
= ∪ ∪ ∪ ∪......
P∗
= {ǫ, 0, 1}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P∗ P0 P1 P2 P3
= ∪ ∪ ∪ ∪......
P∗
= {ǫ, 0, 1, 00, 01, 10, 11}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P∗ P0 P1 P2 P3
= ∪ ∪ ∪ ∪......
P∗
= {ǫ, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 111...etc}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P+ P1 P2 P3
= ∪ ∪ ∪......
P+
= {0, 1}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P+ P1 P2 P3
= ∪ ∪ ∪......
P+
= {0, 1, 00, 01, 10, 11}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Alphabets

Kleene Properties:
P∗
1. represents the kleene star property which can be defined
as Union of all possible power of an alphabet
P+
2. represents the kleene plus property which can bePdefined
as Union of all possible power of an alphabet except 0
shown below.
Examples:
P+ P1 P2 P3
= ∪ ∪ ∪......
P+
= {0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 111...etc}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Strings

P
String is a finite sequence of symbols obtain from the alphabet ,
denoted by W.
P
W∈ ∗
P
Example: if = {a, b, 0, 1} then

W = {0ab11, 00011, abbabb00011ab, etc.}

is the finite sequence of alphabets

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Strings

Very important concept of strings here


Empty String: ǫ represents the empty string
Prefix string: is any number of leading symbols in the strings
Example: if the string W = xyz. The string W has prefix ǫ(empty
string), x, xy and xyz. And in the string Raja, the various prefixes
are ǫ, R, Ra, Raj and Raja
Suffix String: is any number of trailing symbols in the strings.
Example: if the string W = xyz. The string W has Suffix ǫ (empty
string), z, yz and xyz. And in the string Raja, the various prefixes
are ǫ, a, ja, aja and Raja.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Central Concept of Finite Automata - Languages, Problems

A language is a set of strings


P over the alphabets. Denoted by L.
Here L is the subset of ∗ .
Example: A language is the set of strings consisting of equal
number of 0’s and equal number of 1’s.
L = {01, 10, 0011, 0101, 1100, 010101, etc}
Note:
A language consisting of empty string is represented as {ǫ}.
∅ represents the empty language.
Problems: The problem is question deciding whether solution can
be obtained or not.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
Deterministic Finite Automata(DFA)

Definition of DFA
Notations of DFA
How DFA Process the strings?
Extended Transitions Function to the DFA
The Language of DFA
Solved Problems on DFA

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams are


1. off and on - states of the electronic device

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams are


1. off and on - states of the electronic device
2. push - input to the electronic device

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams are


1. off and on - states of the electronic device
2. push - input to the electronic device
3. y - transitions of states

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push
Set of States: off, on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push
Set of States: off, on
Initial State: off

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push
Set of States: off, on
Initial State: off
Transitions: on to off

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push
Set of States: off, on
Initial State: off
Transitions: on to off
off to on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

push
off on
push

the Components of this diagrams can be sumerized as

Input: Push
Set of States: off, on
Initial State: off
Transitions: on to off
off to on
Accepting State: off, on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:
Set of States: Q

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:
Set of States: Q
Initial State: q0

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:
Set of States: Q
Initial State: q0
Transitions: δ

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:
Set of States: Q
Initial State: q0
Transitions: δ
Accepting State: F

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Definition: Hence we can define the Deterministic Finite


Automata consist of 5-tuples (set of states, Input Alphabets,
Transition function, Initial State, Acceptance state), i.e
P
Input:
Set of States: Q
Initial State: q0
Transitions: δ
Accepting State: F

That is
P
D = (Q, , δ, q0 , F)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is
δ (CurrentState, input alphabet) = NextState.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is
δ (CurrentState, input alphabet) = NextState.
δ (off, push) = on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition

Hence DFA can be defined as


P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is
δ (CurrentState, input alphabet) = NextState.
δ (off, push) = on
δ (on, push) = off

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition
Hence DFA can be defined as
P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is
δ (CurrentState, input alphabet) = NextState.
δ (off, push) = on
δ (on, push) = off
q0 ∈ Q is the initial state of DFSA.In the above example {off}
is the initial state of DFSA.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Definition
Hence DFA can be defined as
P
D = (Q, , δ, q0 , F )

Q is the set of states. In the above example Q = {off, on}


P P
is the set of input alphabet. In the above example =
{push}
P
δ is the set of transition functions. Mapping δ : QX to Q.
In the above example it has two transition functions. Format
of transition function is
δ (CurrentState, input alphabet) = NextState.
δ (off, push) = on
δ (on, push) = off
q0 ∈ Q is the initial state of DFSA.In the above example {off}
is the initial state of DFSA.
F ∈ Q is the set of final states of DFSA. In the above
example set {off, on} are the final states of DFSA.
Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Transition Table: Tabular representation of the transition


function is called transition table.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Transition Table: Tabular representation of the transition


function is called transition table.

δ Push

off
→ on
on
off

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Transition Table: Tabular representation of the transition


function is called transition table.
Transition Diagram: Pictorial representation of the transition
function is called transition diagram.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Transition Table: Tabular representation of the transition


function is called transition table.
Transition Diagram: Pictorial representation of the transition
function is called transition diagram.

push
start off on
push

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Example:
P Finite automata to accept at least one a over the
= {a}

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA

Example:
P Finite automata to accept at least one a over the
= {a}
P
Input Alphabet : {a}
Set of States Q: {q0 , q1 }
Initial State: q0
Final State F: q1
Transition Function δ δ(q0 , a) = q1
. δ(q1 , a) = q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA
Example:
P Finite automata to accept at least one a over the
= {a}
P
Input Alphabet : {a}
Set of States Q: {q0 , q1 }
Initial State: q0
Final State F: q1
Transition Function δ δ(q0 , a) = q1
. δ(q1 , a) = q1

Transtion Table: Here we represent transition function into


transition table as shown below
δ a
→ q0 q1
q1
q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Notations of DFA
Example:
P Finite automata to accept at least one a over the
= {a}
P
Input Alphabet : {a}
Set of States Q: {q0 , q1 }
Initial State: q0
Final State F: q1
Transition Function δ δ(q0 , a) = q1
. δ(q1 , a) = q1

Transition Diagram: Here we represent transition function or


Transition Table into Transition Diagram as shown below
a

a
start q0 q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

In this section we are going to describe how the transitions will


take place on each input symbol?.
Example: Consider previous example which accepts atleast one a
and input string W = aaa.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

In this section we are going to describe how the transitions will


take place on each input symbol?.
Example: Consider previous example which accepts atleast one a
and input string W = aaa.
The transition diagram or transition table is

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

In this section we are going to describe how the transitions will


take place on each input symbol?.
Example: Consider previous example which accepts atleast one a
and input string W = aaa.
The transition diagram or transition table is
a

a
start q0 q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

a
start q0 q1

Hence the input string W = aaa can be processed as follows

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

a
start q0 q1

Hence the input string W = aaa can be processed as follows


a
δ(q0 , a) = q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string

a
start q0 q1

Hence the input string W = aaa can be processed as follows


a
δ(q0 , a) = q1

δ(q1 , a) = q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - How DFA processes the string
a

a
start q0 q1

Hence the input string W = aaa can be processed as follows

a a a

δ(q0 , a) = q1
a

δ(q1 , a) = q1

δ(q1 , a) = q1

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z}
x

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001
x

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00
x

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00 1
|{z}
x α

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00 1
|{z}
x α
W = |{z}
0
x

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00 1
|{z}
x α
W = |{z}
0 0
|{z}
x α

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00 1
|{z}
x α
W = |{z}
0 0
|{z}
x α
W = |{z}
ǫ
x

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

W = xα

x is remaining input string


α is the last input symbol. α can also be a ǫ

For Example: W=00101

W = |0010
{z} 1
|{z}
x α
W = |{z}
001 0
|{z}
x α
W = |{z}
00 1
|{z}
x α
W = |{z}
0 0
|{z}
x α
W = |{z}
ǫ 0
|{z}
x α

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem
Basis: δ̂(q0 , ǫ) = q0 . Here the transition on with out any input
alphabet or zero symbol or NULL symbol i.e ǫ will be in the same
state i.e q0 .

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem
Basis: δ̂(q0 , ǫ) = q0 . Here the transition on with out any input
alphabet or zero symbol or NULL symbol i.e ǫ will be in the same
state i.e q0 .
Induction:

W = xα

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem
Basis: δ̂(q0 , ǫ) = q0 . Here the transition on with out any input
alphabet or zero symbol or NULL symbol i.e ǫ will be in the same
state i.e q0 .
Induction:

W = xα

x = xα until x ∈ ǫ

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem
Basis: δ̂(q0 , ǫ) = q0 . Here the transition on with out any input
alphabet or zero symbol or NULL symbol i.e ǫ will be in the same
state i.e q0 .
Induction:

W = xα

x = xα until x ∈ ǫ

δ̂(q0 , W ) = δ̂(q0 , xα)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


Theorem
Basis: δ̂(q0 , ǫ) = q0 . Here the transition on with out any input
alphabet or zero symbol or NULL symbol i.e ǫ will be in the same
state i.e q0 .
Induction:

W = xα

x = xα until x ∈ ǫ

δ̂(q0 , W ) = δ̂(q0 , xα)


δ̂(q0 , xα) = δ(δ̂(q0 , x), α) Recursively

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 ,

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)
δ(δ(δ̂(q0 , a), a), a) = δ(δ(δ(δ̂(q0 , ǫ), a), a), a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)
δ(δ(δ̂(q0 , a), a), a) = δ(δ(δ(δ̂(q0 , ǫ), a), a), a)

δ(δ(δ(δ̂(q0 , ǫ), a), a), a) = δ(δ(δ(q0 , a), a), a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)
δ(δ(δ̂(q0 , a), a), a) = δ(δ(δ(δ̂(q0 , ǫ), a), a), a)

δ(δ(δ(δ̂(q0 , ǫ), a), a), a) = δ(δ(δ(q0 , a), a), a)


δ(δ(δ(q0 , a), a), a) = δ(δ(q1 , a), a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)
δ(δ(δ̂(q0 , a), a), a) = δ(δ(δ(δ̂(q0 , ǫ), a), a), a)

δ(δ(δ(δ̂(q0 , ǫ), a), a), a) = δ(δ(δ(q0 , a), a), a)


δ(δ(δ(q0 , a), a), a) = δ(δ(q1 , a), a)
δ(δ(q1 , a), a) = δ(q1 , a)

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Extended Transition Function (δ̂) to DFA

Note: Things to be known - W = xα, x = xα until x∈ ǫ


δ̂(q0 , ǫ) = q0 , δ̂(q0 , W ) = δ̂(q0 , xα)
δ̂(q0 , xα) = δ(δ̂(q0 , x), α)
Example
If you consider the previous input string processed is W=aaa

δ̂(q0 , W ) = δ̂(q0 , aaa)


δ̂(q0 , aaa) = δ(δ̂(q0 , aa), a)
δ(δ̂(q0 , aa), a) = δ(δ(δ̂(q0 , ǫa), a), a)
δ(δ(δ̂(q0 , a), a), a) = δ(δ(δ(δ̂(q0 , ǫ), a), a), a)

δ(δ(δ(δ̂(q0 , ǫ), a), a), a) = δ(δ(δ(q0 , a), a), a)


δ(δ(δ(q0 , a), a), a) = δ(δ(q1 , a), a)
δ(δ(q1 , a), a) = δ(q1 , a)
δ(q1 , a) = q1 q1 ∈ F

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Definition

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Definition
The Language of Deterministic Finite State Machine can be
defined as

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Definition
The Language of Deterministic Finite State Machine can be
defined as

L = {W

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Definition
The Language of Deterministic Finite State Machine can be
defined as
P∗
L = {W|W ∈

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - The Language of DFA

Definition
The Language of Deterministic Finite State Machine can be
defined as
P∗
L = {W|W ∈ and δ̂(q0 , W ) ∈ F }

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd
P
Problems on Consecutive

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd
P
Problems on Consecutive
P
Problems on Followed by

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd
P
Problems on Consecutive
P
Problems on Followed by
P
Problems on Combination on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd
P
Problems on Consecutive
P
Problems on Followed by
P
Problems on Combination on
P
Problems on Divisible by k on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Solved Examples

P
Problems on Atleast and Atmost
P
Problems on Starting and/or Ending
Problems on Sub-string
P
Problems on Even and/or Odd
P
Problems on Consecutive
P
Problems on Followed by
P
Problems on Combination on
P
Problems on Divisible by k on
P
Problems on Modulo K-Counter on

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - General Procedure to solve the problems

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - General Procedure to solve the problems

P
1. Identify the Input Alphabet , minimum String (MS)
required to design the Machine and Draw the State Transition
Diagram for the minimum string with initial State.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - General Procedure to solve the problems

P
1. Identify the Input Alphabet , minimum String (MS)
required to design the Machine and Draw the State Transition
Diagram for the minimum string with initial State.
2. Construct the Transition function δ for each input symbol on
each state except transitions of the MS transition Diagram.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - General Procedure to solve the problems

P
1. Identify the Input Alphabet , minimum String (MS)
required to design the Machine and Draw the State Transition
Diagram for the minimum string with initial State.
2. Construct the Transition function δ for each input symbol on
each state except transitions of the MS transition Diagram.
3. Identify the Final State by testing the input symbols and
Construct the Final Transition Table, State Transition
Diagram.
Note: This procedure can be used to construct the DFSA except
Divisible by K-Problems and Modulo K-Counter Problems.

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Simple Solved Problem

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata
DFA - Simple Solved Problem

Example
Design a DFSA to accept the strings of a’s having atleast two a or
Design the DFSA for the Language L={an |n > 2} .
Solution:P
Step 1: = {a}, MS= aa

a a
start q0 q1 q2

Step 2:

δ(q0 , a)=q1 , δ(q1 , a)=q2 , δ(q2 , a)=?

Basappa B. Kodada Asst. Professor, Dept. of CSE UNIT I - Introduction to Finite Automata

You might also like