Lecture 10

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Theory Of Automata

1
Lecture # ….
Theory of Automata

2
Recall…….
 What is Automata?
 It is the plural of automaton, and it means
“something that works automatically”.

3
4
5
Finite Automata
A language defining method
 Also known as Finite State Machine (FSM), Finite

State Automata (FSA) ,State Machines.


 It is just like a ludo in which token changes position

on the input if certain number of dice

6
Finite Automata
 A FA is defined as follows:-
◦ Finite number of states in which one state must be
initial state and more than one or may be none can
be the final states.
◦ Sigma Σ provides the input letters from which
input strings can be formed.

◦ FA Distinguishing Rule: For each state, there


must be an out going transition for each input
letter in Sigma Σ.

7
Types of Finite Automata

8
9
1:Deterministic Finite Automata
 It represents an abstract machine which is used to
represent a regular language

 A regular expression can also be represented using


Finite Automata

 There are two ways to specify an FA:


1) Transition Tables and
2) Directed Graphs.

10
Graphical Representation
Each node (or vertex) represents a state, and the
edges (or arcs) connecting the nodes represent
the corresponding transitions.
Each state can be labeled

11
 DFA consists of 5 tuples {Q, ∑, q, F, δ}.

 Q : set of all states.


 ∑ : set of input symbols. ( Symbols which machine

takes as input )
 q : Initial state. ( Starting state of a machine )
 F : set of final state.
 δ : Transition Function,

defined as δ : Q X ∑ --> Q.

12
 For a particular input character, the machine goes to
one state only.

 Null (or ε) move is not allowed.

 DFA cannot change state without any input


character.

Question: Why FA is said to Finite Automata?

13
Transition Table
STATE INPUT INPUT
0 1
q0 q1 q0
q1 q1 q2
* q2 q2 q2

 The indicates the start state: here q0


 The * indicates the final state(s) (here only one final

state q1)

14
 This defines the following transition diagram

 0 1
q0 q1 q2

 1 0 0,1

15
Examples
1: Construct a DFA for a language L = {aa}

∑ = {a}
L ={aa} (Language with only one string aa)

a a a
q0 q1 q2 D

D= Dead State a

16
2: Construct a DFA for a language L = {aba}

∑ = {a,b}
L ={aba} (Language with only one string aba)

Here ,q4 = Dead state


a

a b a

q0 q1 q2 q3
b
b a,b
a,b
q4
a,b
17
3: Construct a DFA with ∑ = {0, 1} accepts all
strings starts with 0.
Also construct a Transition Table for the this DFA

Hint: First make the language for the above DFA.

18
 Construct a DFA with ∑ = {0, 1} accepts all strings
starts with 0.
 L = {0,00,01,001,011,……..}

0,1
0
q0 q1

0,1
q2

19
Here
 q0 is initial or start state

On getting 0 input it goes to q1


On getting 1 input it goes to q2

 q1 is the final state having self loop (having all


combinations of 0 and 1 strings)

 The state q2 is the Dead State or Trap state.

 Dead State: The strings are trapped in this state and will
not reach the final state and hence not acceptable by DFA

 The strings which reaches the final state will only be


accepted by DFA.
20
4: Construct a DFA with ∑ = {0, 1} accepts all
strings ending with 0.

21
Construct a DFA with ∑ = {0, 1} accepts all strings
ending with 0.

L= {0,00,10,000,100,110,0000,…….}

 Construct a Transition Table for the above DFA

22
5:Construct a DFA that accepts set of all strings
over {0, 1} of length 2 .
Also define 5 tuples for it .

23
 ∑ = {0, 1}
 L ={00,01,10,11}

0,1 0,1
q0 q1 q2

0,1

0,1
q2

24
6: Construct a DFA that accepts set of all strings
ending with 100

25
 ∑ = {0, 1}
 L ={100,0100,1100,01100,……..}

1 0 0
q0 q1 q2 q3

0 1

0, 1

26
Designing Finite Automata from Regular
Expression

1: Construct a DFA for R.E. = ab(a+b)*


(Hint: make strings (language) for the mentioned
R.E).

Solution:

 ∑={a,b}
 L= {ab,aba,abb,abaa,abab,abba,abbb,….}

27
Construct a DFA for R.E. = ab(a+b)*

q0
a b q2
q1

a,b
a

b q3
a,b

28
 Don’t forget to draw Transition Table and mention 5
tuples for the all of these examples.

29
 2:Draw a DFA for the language accepting strings
starting with ‘a’ over alphabets {a,b}

30
 2:Draw a DFA for the language accepting strings
starting with ‘a’ over alphabets {a,b}

Solution:
 ∑ = {a,b}
 Regular Expression for the language will be

a(a+b)*

 L= {a,aa,ab,aaa,aab,aba,abb,…….}

31
 The required DFA is :

a,b
q0 q1
a

b
D
a,b

32
3:Construct a DFA for a regular expression
101(0+1)*

Solution:
 ∑ = {0,1}
 L = {101,1010,1011,10100,10101,10110,10111,

…………}

33

0,1

q0 1 0q1 1 q2 q3

0 1 0

D
0,1

34
4: Draw a DFA that accepts a language L over input
alphabets {0,1} such that L is the set of all the
string starting with 00.

35
Solution:
 ∑ = {0,1}
 Regular Expression for the language will be

00(0+1)*

 L= {00,000,001,0000,0001,0010,0011,…….}

36

0,1

q00 q1 0 q2

1
1
D
0,1

37
5: Construct a DFA that accepts a language L over
imput alphabets {a,b} such that L is the set of all
string starting with aa or bb.

38
Solution:
 ∑ = {a,b}
 Regular Expression for the language will be

(aa+bb)(a+b)*

 L= {aa,bb,aaa,aab,bba,bba,……..}

39

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy