Professional Documents
Culture Documents
Gate Toc Dfa
Gate Toc Dfa
Gate Toc Dfa
machines
4. Undecidability.
1 ELTP-GATE 2015
Models of Computation
2 ELTP-GATE 2015
Computation
CPU memory
3 ELTP-GATE 2015
temporary memory
input memory
CPU
output memory
Program memory
4 ELTP-GATE 2015
Example: f ( x) = x 3
temporary memory
input memory
CPU
output memory
Program memory
compute x∗x
compute x ∗x
2
5 ELTP-GATE 2015
f ( x) = x 3
temporary memory
input memory
x=2
CPU
output memory
Program memory
compute x∗x
compute x ∗x
2
6 ELTP-GATE 2015
temporary memory f ( x) = x 3
z = 2*2 = 4
f ( x) = z * 2 = 8
input memory
x=2
CPU
output memory
Program memory
compute x∗x
compute x ∗x
2
7 ELTP-GATE 2015
temporary memory f ( x) = x 3
z = 2*2 = 4
f ( x) = z * 2 = 8
input memory
x=2
CPU
f ( x) = 8
Program memory output memory
compute x∗x
compute x ∗x
2
8 ELTP-GATE 2015
Automaton
temporary memory
Automaton
input memory
CPU
output memory
Program memory
9 ELTP-GATE 2015
Different Kinds of Automata
Automata are distinguished by
the temporary memory
10 ELTP-GATE 2015
Finite Automaton
temporary memory
input memory
Finite
Automaton
output memory
Example: Vending Machines, Control Unit in CPU
(small computing power)
11 ELTP-GATE 2015
Pushdown Automaton
Stack Push, Pop
input memory
Pushdown
Automaton
output memory
input memory
Turing
Machine
output memory
Examples: Any Algorithm
(highest computing power)
13 ELTP-GATE 2015
Computation Power of Automata
14
ELTP-GATE 2015
Finite Automata
15 ELTP-GATE 2015
Finite Automaton
Input
String
Output
Finite String
Automaton
16 ELTP-GATE 2015
Type of Finite Automaton
Acceptors and Transducers
Acceptor -- Only output = yes/no
State-based output
Transition-based output
17 ELTP-GATE 2015
Finite Accepter
Input
String
Output
“Accept”
Finite
or
Automaton “Reject”
18 ELTP-GATE 2015
Transition Graph or State Diagram
abba -Finite Accepter a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
initial final
state state
transition
state “accept”
19 ELTP-GATE 2015
Another Example
a a, b
q0 b q1 a, b q2
20 ELTP-GATE 2015
1. Deterministic Finite Automaton
Next-State Function
Next-State Relation
21 ELTP-GATE 2015
Formalities
Deterministic Finite Accepter (DFA)
M = (Q, Σ, δ , q0 , F )
Q : set of states
Σ : input alphabet
δ : transition function
q0 : initial state
Σ = {a, b}
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
23 ELTP-GATE 2015
Set of States Q
Q = {q0 , q1, q2 , q3 , q4 , q5 }
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
24 ELTP-GATE 2015
Initial State q0
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
25 ELTP-GATE 2015
Set of Final States F
F = {q4 }
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
26 ELTP-GATE 2015
Trap State
Any words with prefixes that take you to a
trap state will not be accepted
Example: Machine accepting words over {0,1}
that start with 0:
0,1
0
1
0,1 Trap State
27 ELTP-GATE 2015
Transition Function δ
δ :Q×Σ → Q
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
28 ELTP-GATE 2015
δ (q0 , a ) = q1
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
29 ELTP-GATE 2015
Transition Function δ
δ a b
q0 q1 q5
q1 q5 q2
q2 q2 q3
q3 q4 q5 a, b
q4 q5 q5
q5 q5 q5 q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
30 ELTP-GATE 2015
Extended Transition Function δ *
δ * : Q × Σ* → Q
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
31 ELTP-GATE 2015
δ * (q0 , abba ) = q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
32 ELTP-GATE 2015
Languages Accepted by DFAs
Take DFA M
Definition:
The language L( M ) contains
all input strings accepted by M
33 ELTP-GATE 2015
Example
L(M ) = {abba} M
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
accept
34 ELTP-GATE 2015
Another Example
L(M ) = {λ , ab, abba} M
a, b
q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4
accept accept accept
35 ELTP-GATE 2015
Formally
Language accepted by M :
L(M ) = {w ∈ Σ* : δ * (q0 , w) ∈ F }
L(M ) = {w ∈ Σ* : δ * (q0 , w) ∈ F }
Language rejected by M :
L(M ) = {w ∈ Σ* : δ * (q0 , w) ∉ F }
37 ELTP-GATE 2015
More Examples
L(M ) = {a b : n ≥ 0}
n
a a, b
q0 b q1 a, b q2
38 ELTP-GATE 2015
L(M ) = { all strings with prefix ab }
a, b
q0 a q1 b q2
b a accept
q3 a, b
39 ELTP-GATE 2015
L (M ) = { all strings without
substring 001 }
1 0 0,1
1
λ 0 1
0 00 001
0
40 ELTP-GATE 2015
1.
41 ELTP-GATE 2015
2.
42 ELTP-GATE 2015
3.For construct dfa’s that accept the sets
consisting of
(a) all strings with exactly one a,
(b) all strings with at least one a,
(c) all strings with no more than three a’s,
(d) all strings with at least one a and exactly
two b’s.
(e) all the strings with exactly two a’s and
more than two b’s.
43 ELTP-GATE 2015
Let ∑ = {a, b}. Define the language A = {w ∈ ∑* | w = sbab for some string s ∈ ∑*}.
Draw a DFA for A.
44 ELTP-GATE 2015
In each part of this question, Design an DFA that accepts the given language.
(a) The language of all strings ending with b.
(b) The language of all strings containing the substring bb.
(c) The language of all strings containing either the substring bb or the
substring baab.
45 ELTP-GATE 2015