L3
L3
L3
2
Theory of Computation
Example (1) There are two transitions labeled a out of q0 This is NFA. The language
accepted by it is L(A) = { xn | n There are two accept states { q3 , q5 }.
Example (2)
Suppose we are in q1 and input is 1. After reading this symbol, NFA splits into
multiple copies of itself and follows all the possibilities in parallel. Each copy of NFA
takes one of the possible ways to proceed and continue as before. If there are
subsequent choices, NFA splits again. If the next input symbol does not appear on
any of the arrows exiting the state occupied by a copy of NFA, that copy dies along
with the branch of the computation associated with it. Finally, if any one of these
copies of the NFA is in an accept state at the end of the input, the NFA accepts 3 the
input string. In the above diagram, state q1 has one exiting arrow for 0 but it has
Theory of Computation
two for 1. q2 has 1 for 0 but non for 1. It also has a label with . Thus, in an NFA,
a state may have zero, one or many exiting arrows for each alphabet symbol.
Another way to think of NFA as a tree of possibilities. The root of the tree
corresponds to start of the computation. Consider 010110 and process it by
NFA given above. It accepts all strings that contain either 101 or 11 as a
substring.
4
Theory of Computation
Example (3) Consider the following NFA
It has a -transition. Some transitions, such as, δ(q2, 0) is unspecified in the graph.
This is to be interpreted as a transition to the empty set, that is, δ(q2, 0) = . The NFA
accepts strings , 1010, and 101010, but not 110 and 10100. Note that for 10 there
are two alternative walks, one leading to q0, the other to q2. Even though q2 is not a
final state, the string is accepted because one walk leads to a final state.
Example (4) which of the strings 00, 01001, 10010, 000, 0000 are accepted by the
following NFA.
5
Theory of Computation
Walk.
Let us define what we mean by a walk in a graph. A sequence of edges in a graph is
said to be a walk from vi to vn if we have (vi , vj) , (vj , vk) , …., (vm , vn). The length of
the walk is the total number of edges in going from vi to vn . A walk in which no
edge is repeated is said to be a path. It is a simple path if no vertex is repeated.
Example (5)