Professional Documents
Culture Documents
AT2: Automata Theory: Colin Campbell Engineering Mathematics Department
AT2: Automata Theory: Colin Campbell Engineering Mathematics Department
Colin Campbell
Engineering Mathematics Department
C.Campbell@bris.ac.uk
It is not a DFA since there are two edges labelled 0 which are
outgoing from node q1 : this makes it non-deterministic.
the other feature is that q2 is a sink node: once you enter
there is no escape!
The definition of a NFA is the same as for a DFA except that the
transition function returns a set of states, rather than a single
state. Formally, we write this as δ : Q × Σ → 2Q , basically the
power set of Q, the set of all subsets of Q.
The operation on an input string w is then:
we start on q0
for each symbol in w , determine all possible states reachable
from the current set of states.
when all symbols in w have been used, w is accepted if and
only if at least one current state is final.
Let’s start with a simple automaton which accepts the string 010
and nothing else:
0 1 0
q0 q1 q2 q3
0 1 0
q0 q1 q2 q3
The lower branch (with the B’s) excludes strings containing 000: if
we get to B3 and receive a 0 then we enter the dead state and do
not accept.
δ 0 1
→ q0 {q0, q1 } {q0 }
q1 {} {q2 }
? q2 { q2 } {q2 }
Hence, we ignore all states that are not reachable from {q0 }, i.e.
we delete rows 1,3,4,7 and 8, giving a much reduced transition
table:
δD 0 1
(start) {q0 } {q0 , q1 } { q0 }
{q0 , q1 } {q0 , q1 } { q0 , q2 }
(final) {q0 , q2 } {q0 , q1 } { q0 }
δN 0 1
→ q0 { q0 , q1 } {q0 }
q1 {} ?{q2 }
? q2 {} {}
From the start → q0 we see that we must create a new row and
node {q0 , q1 }. We read off the entries for {q0 , q1 } from entries
under 0 and 1 in the NFA δN transition table. We find a new node
{q0 , q2 } is created. We again read off its entries from δN but, at
that point, we have no new nodes, so we stop and draw the
transition diagram. As a procedure, and starting from the
transition diagram for the NFA:
Q = {q0 , q1 , q2 }
Σ = (0, 1)
F = {q2 }
The moves from state {q0 , q1 } are not present in the transition
table of the DFA so we calculate it as so:
δ0 ({q0 , q1 }, 0) = δ(q0 , 0) ∪ δ(q1 , 1) = {q0 , q1 }
δ0 ({q0 , q1 }, 1) = δ(q0 , 1) ∪ δ(q1 , 1) = {q0 , q2 }
State 0 1
q0 {q0 , q1 } q0
{ q0 , q1 } {q0 , q1 } { q0 , q2 }
State 0 1
→ q0 {q0 , q1 } q0
{ q0 , q1 } {q0 , q1 } ?{q0 , q2 }
?{q0 , q2 } {q0 , q1 } q0
0,1
q2
0 0
0
q0 q1
Let Q 0 be the set of states for the equivalent DFA and let T 0 be
the transition table for the new DFA we are constructing. We first
add the state q0 to T 0 :
State/node 0 1
→ {q0 } { q1 , q2 } φ (dead state)
where, as commented → marks our start node, and φ represents
the null set or dead node.
0 1
0 1
q0 q 1 ,q 2 q2
0,1
0
1
We do not give the working now: see if you find the transition
table and diagram for the equivalent DFA given below. Transition
table of the NFA:
Present state 0 1
→ q0 q0 {q0 , q1 }
q1 {} ?q2
? q2 {} {}
Giving:
0
1
1 1
q0 q 0 ,q 1 q 0 ,q 1 ,q 2
0
0
1
q0 q1
1 0,1
0 0,1
q 22
Giving:
0 1 0
1 0
q0 q 1 ,q 2 q 0 ,q 1 ,q 2