Kanan Sasaki
38399655
Professor Goodrich
13 January 2017
CS 162 Homework #1
.10
1.
2.
3.
4.
5.
6.
7.
a=b
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
Therefor
CS 162
Fall 2015
Homework 4 Problems
October 21, 2015
Timothy Johnson
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
CS 162
Fall 2015
Homework 3 Problems
October 13, 2015
Timothy Johnson
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
L is
CS 162
Fall 2015
Midterm 1 Study Questions - Solutions
October 14, 2015
Timothy Johnson
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
CS 162
Fall 2015
Homework 1 Problems
September 30, 2015
Timothy Johnson
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
Homework 1
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
2.18
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
Homework 2
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
Homework 5
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
Kanan Sasaki
38399655
Professor Goodrich
10 January 2017
Homework #4
1. Terminals cfw_0, 1
Variables = cfw_S
Start Symbol = cfw_S
Productions =
S -> 011
S -> 0S11
2. Base case: A single character x, we can just have a CFG with a single transition: S -> x
Kanan Sasaki
38399655
Professor Goodrich
27 January 2017
Homework #3
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
Kanan Sasaki
38399655
Professor Goodrich
20 January 2017
Homework #2
1.7b
1.7c
1.7e
1.7h
1.14a
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