13 January 2017
CS 162 Homework #1
a * a = b * a = a2 = ab
a2 b2 = ab b2
(a + b) (a -b) = b (a b)
(a + b) (a b) / (a b) = b (a b) / (a b) = a + b = b
Let a and b = 1; 1 + 1 = 1
Homework 4 Problems
October 21, 2015
1. Let L = cfw_0n 12n |n > 0 Give a CFG for L.
The following CFG will produce L.
S 0S11 | 011 |
2. Show that every regular language L is also context free. Hint: use a proof by inductio
Homework 3 Problems
October 13, 2015
1. Let L be the language of all string of balanced parentheses, that is, all strings of the characters
( and ) such that each ( has a matching ). Use the Pumping Lemma to show that
Midterm 1 Study Questions - Solutions
October 14, 2015
1. Give a DFA for the following languages over the alphabet cfw_0, 1.
(a) cfw_w|w has at least three 0s and an odd number of 1s
(b) cfw_w|w has an even number of 0s an
Homework 1 Problems
September 30, 2015
1. Exercise 2.2.4 on page 53 of Hopcroft et al.
Give DFAs accepting the following languages over the alphabet cfw_0, 1.
(a) The set of all strings ending in 00.
(b) The set of all str
0.10 Find the error in the following proof that 2 = 1. Consider the equation a = b. Multiply both
sides by a to obtain a^2 = ab. Subtract b^2 from both sides to get a^2b^2 = abb^2. Now factor
each side, (a+b)(ab) = b(ab), and divide each side b
a. Let C be a context-free language and R be a regular language. Prove that the language C
R is context free.
b. Let A = cfw_w|w cfw_a, b, c and w contains equal numbers of as, bs, and cs. Use part (a) to
show that A is not a CFL.
2.30 Use the pumpi
1.7 Give state diagrams of NFAs with the specified number of states recognizing each
of the following languages. In all parts, the alphabet is cfw_0,1.
b. The language of Exercise 1.6c with five states
c. The language of Exercise 1.6l with six
1. For n=1, 2n-1 = 2(1) - 1 = 1
For n=k, 2n-1 = 2k-1
For n=k+1, since n>1, a language in CNF would be S->BC, B->*a, C->*a
So the length of the string with starting symbol S is |w|=ab where |a| and |b| are > 0.
The derivation of w must be 1+(2|a
10 January 2017
1. Terminals cfw_0, 1
Variables = cfw_S
Start Symbol = cfw_S
S -> 011
S -> 0S11
2. Base case: A single character x, we can just have a CFG with a single transition: S -> x
27 January 2017
Use this for questions 1 and 2
By the Pumping Lemma, the language L must satisfy the following conditions:
|xy| <= n
|y| > 0
Xyiz L for all I > 0
1. If a word w follows the language L, t
20 January 2017
The reason that the complement of the original M recognizes the complement B is that both M and the
complement of M have the same transition function. This mean