0% found this document useful (0 votes)
28 views27 pages

Automata Theory and Computability (17CS54) : 5 Semester

Uploaded by

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

Automata Theory and Computability (17CS54) : 5 Semester

Uploaded by

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

LECTURE 1.

3
SRI KRISHNA INSTITUTE OF TECHNOLOGY
FINITE STATE MACHINE#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Automata Theory and


Computability (17CS54)
5th Semester
Geetha Megharaj
Department of Computer Science and
Engineering
[email protected]

Dept Name Subject name / code


Computer Science and Engineering 18CS54
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Recap of Previous Lecture

DFA
LANGUAG
STRING DEFINITIO
E
N

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

LEARNING OBJECTIVES OF
THIS LECTURE

DESIGN OF DFA

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

LEARNING OBJECTIVES FROM


THIS LECTURE

• In this lecture, students shall be able to understand

DESIGN OF TRANSITION
DFA DIAGRAMS

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Finite State Machines (FSM):

Two types – both describe what are called regular


languages
Deterministic (DFA) – There is a fixed number of
states and we can only be in one state at a time

Nondeterministic (NFA) –There is a fixed number of


states but we can be in multiple states at one time
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Deterministic Finite Automata (DFA)

A DFA is a five-tuple: M = (Q, Σ, δ, q0, F)

Q A finite set of states


Σ A finite input alphabet
q0 The initial/starting state, q0 is in Q
F A set of final/accepting states, which is a subset of Q
δ A transition function, which is a total function from Q
x Σ to Q

δ: (Q x Σ) –> Q , δ is defined for any q in Q and s in Σ, and


δ(q, s) = q’ is equal to another state q’ in Q.
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Problem – 2:
Write a DFSM to accept the language
L = { w ϵ {a, b}* | |w| is even length}
Step 1: Write strings accepted by L i.e.
L = { ɛ, aa, bb, ab, ba, aaaa, bbbb, bbaa, baba,..}
~L= { a, b, aaa, bbb, aba, bab, bba, aab, aabbb,..}

Step 2: since min string are {ɛ, aa}, 2 states are required.

Step 3: Write Transition Diagram.


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

State Transition Diagram

δ (1,a)=2
δ (1,b)=2
δ (2,a)=1
Transition table δ (2,b)=1
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

To show some strings are not accepted


Ex: to show string bba not accepted
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Problem – 3: Write a DFSM to accept the language


L = { w ϵ {a, b}* | ab is a substring of w}

Step 1: Write strings accepted by L i.e.


L = { ab, abab, aaab, abaaa, abbbb, bbababab, babb, bbab,
baba,..}
~L= { a, b, aa, bb, bbb, bba, bba, aaa, bbbbb,..}

Step 2: since min string is { ab}, 3 states are required.

Step 3:Write Transition Diagram


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Ex: to show string aba accepted

Ex: to show string bba accepted


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Problem – 4:

Write a DFSM to accept the language


L = { w ϵ {a, b}* | every w ends in b }
L = {,..}
~L= {,..}
Step 2: since min string are { b}, 2 states are required.
Step 3: Write Transition Diagram.
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090
SRI KRISHNA INSTITUTE OF TECHNOLOGY
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Transition Diagram Transition table

Computer Science and Engineering 18CS54


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

to show string ab accepted

Since 2 is final state the string ab ends with b and is


accepted
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Example : Construct DFA to accept strings of 0’s and 1’s ending


with 011

L = { w ϵ {0, 1}* | every w ends with 011 }


L = {001,01001, 10,..}
~L= {,..}

Step 2: since min string are { 001}, 4 states are


required.
Step 3: Write Transition Diagram.
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

q0 q1 q2 q3

δ 0 1

Q0

Q1

Q2

Q3
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Design DFA to accept strings of a’s and b’s starting with ab

L = { w ϵ {a, b}* | every w starts with ab }


L = {ab, abb, abba, abbb, …. }
L’ = {ba, bbb, baa,…………………….}

Step 2: since min string is {ab}, 3 states are required.


Step 3: Write Transition Diagram.
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Transition Diagram

q0 q1 q2

Transition table
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090
SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Learning outcome from this lecture

DFA
EXAMPL
ES

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

DISCUSSION

5 Minutes

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

Content to be covered in next lecture

1. Deterministic Finite Automata

2. Design of DFA

3. Examples of DFA

Dept Name Subject name / code


SRI KRISHNA INSTITUTE OF TECHNOLOGY
Computer Science and Engineering 18CS54
#29, Hesaraghatta Main Road, Chimney Hills, Chikkabanavara Post, Bangalore- 560090

THANK YOU

Dept Name Subject name / code

You might also like