You are on page 1of 4

CS311-Automata and Complexity Theory

Homework 01
Due Date Wednesday, December 17, 2003
NOTE: It is possible to solve a problem by various methods and get to (seemingly)
different solutions.
Problem 1 [15 points]
Following are some language definitions over the alphabet {0,1}. Design a DFA
corresponding to each language.
A={w:wcontainsoddnumberof0sandoddnumberof

1s}
The example given in your book about the Even-Even automata has four states. If you
look closely at the four states they represent Even-Even, Odd-Even, Even-Odd and OddOdd. You just need to figure out which final state to use.
B={w:wcontainsthesubstring01001}

The strategy is to start by making the FA (which might be incomplete!!) for the minimum
length string belonging to the given language. Obviously the minimum length string in
this case is 01001. So you start by making a start-to-final automaton accepting just this
string. Then depending on the type of the FA (DFA/NFA) take care of the other transitions
as well. In case of a DFA if you do not show an expected transition then by default you
are assuming that the FA goes to the junk/crash state on this particular input. So be
careful! However, in this FA there is no separate junk/crash state and all transitions must
be displayed. Heres what you need to do.

0, 1

0
0
1

1
0

C={w:wdoesnotbeginandendwiththesameletter,

andcontainsoddnumberof1s}

The language can be written as the intersection of two languages; One that accepts all
strings that end in different letters, and the second being with and odd number of 1s. The
easy approach to doing this is by building these two DFAs separately and then carefully
merging these two together. However here we just give the two separate FAs and develop
the required one separately.

0
1
0

This is what the final automaton looks like.

0
1

1
1

0
0

0
0

1
Problem 2 [15 points]
Prove that if L1, L2 and L3 are languages over some alphabet then
L1 ( L2 L3 ) = L1 L2 L1 L3
Proof:
For any two sets A and B in order to show (prove) A equals B, we must show (prove) that
A is a subset of B and B is subset of A. Formally, A = B iff A B and B A. There are
many ways for going about this. You can use induction on the length of string w and
show that for all w A, w B to prove A B; and for all w B, w A to prove B A.
Here we give a slightly different approach, where we look at how w is actually
constructed.
Part 1 First we show that L1 (L2 L3) L1L2 L1L3.
Let w L1(L2 L3). Then w = xy with x L1 and y L2 L3. So we have either y L2
or y L3. If y L2, then xy L1L2; otherwise y L3 and xy L1L3.
This shows that all xy L1L2 or xy L1L3 which implies that xy L1L2 L1L3.

L1(L2 L3) L1L2 L1L3.


Part 2 Now we show L1L2 L1L3 L1(L2 L3).
Suppose w L1L2 L1L3; then either w L1L2 or w L1L3.
If w L1L2, w = xy with x L1 and y L2. But yL2L3 as L2 L2L3; so w = xy
L1(L2 L3).
Otherwise, if w L1L3, w = xz with xL1 and zL3. But then z L2L3 as L3 L2L3.
So w = xz L1(L2 L3).
Thus, in all cases, w L1(L2L3). So L1L2L1L3 L1(L2L3).
We conclude L1(L2 L3) = L1L2 L1L3.
Problem 3 [20 points]
Describe the language of the following automata:
0

a)

1
0, 1

0
It is tempting to state that this automaton accepts all strings that end with 1s and are
length at least 2. Unfortunately the points for this automaton suggest otherwise. The
outgoing transition from the final state on input 0 will send us back to the start state. In a
way this acts like a loop, or a Kleene Star (*) operation. This restricts the automata to a
subclass of the language that is given earlier. For example it wont accept 0101, but it will
accept 010101. It will never accept any string ending with zero or more 1s followed by a
1101, where as the earlier described language would. The precise regular expression of
this language is given as
( (0+1)0*11*0 )* . (0+1)0*11*

1
b)

1
1

This automaton accepts all strings that contain exactly three consecutive 0s. No more
then three consecutive 0s are accepted as that would lead to a junk state

You might also like