CS 3133 Foundations of Computer Science
C term 2014
Solutions for Homework 2
READING: Chapters 3, 4, 5, 18.
1. Exercise 2 on page 97.
Solution:
(a) The following is a leftmost derivation of aabbba:
S
ASB
aAbSB
aaAbbSB
aabbSB
aabbB
aabbba
(b) The fol
CS 3133 Foundations of Computer Science
C term 2014
Homework 4, due Monday, February 24
READING: Chapters 6, 7, 8.
1. Use the technique from Section 6.1 in the book (i.e. constructing an
NFA for a given regular set by following the recursive denition of
CS 3133 Foundations of Computer Science
C term 2014
Homework 3, due Monday, February 10
READING: Chapters 4, 5, 6.
1. Exercise 1 on page 184. (20 points)
2. Exercise 12 on page 185. (20 points)
3. Design a DFA that accepts the language consisting of the s
CS3133
HW#3
DUE: Monday, September 10
*
1. (10 points) Define the shufflereverse operation : * * 2 for any alphabet by
ax x a ,
ax x a ,
ax by x by a ax y b
for all a, b , x, y * . For example, 01 ab ba10, b1a 0,1ba 0,10ba,1b0a, b10a . We
extend the d
CS 3133 Foundations of Computer Science
C term 2014
Sample Problems for the Midterm Exam
These problems are sample problems for the midterm exam, so you may
expect similar problems in the midterm. Do not hand in your solutions.
Solutions will be handed ou
CS 3133 Foundations of Computer Science
C term 2015
Solutions for Homework 5
1. Exercise 17.b. on page 249.
Solution: (with the pumping lemma for contextfree languages) Let
us assume indirectly that the language L = cfw_ai bj ci dj  i, j 0 is
contextfr
CS 3133 Foundations of Computer Science
C term 2014
Solutions for Homework 5
1. Exercise 17.b. on page 249.
Solution: (with the pumping lemma for contextfree languages) Let
us assume indirectly that the language L = cfw_ai bj ci dj  i, j 0 is
contextfr
CS 3133 Foundations of Computer Science
C term 2014
Practice Final Exam
These problems are sample problems for the nal exam, so you may expect
similar problems in the nal. Do not hand in your solutions. Solutions will
be posted on the web tomorrow. The na
CS 3133 Foundations of Computer Science
C term 2014
Solutions of the Sample Problems for the Midterm
Exam
1. Give a regular expression that represents the set of strings over =
cfw_a, b that contain the substring ab and the substring ba.
Solution:
a+ b+ a
CS 3133 Foundations of Computer Science
C term 2015
Solutions for Homework 2
READING: Chapters 3, 4, 5, 18.
1. Exercise 2 on page 97.
Solution:
(a) The following is a leftmost derivation of aabbba:
S
ASB
aAbSB
aaAbbSB
aabbSB
aabbB
aabbba
(b) The fol
CS 3133 Foundations of Computer Science
C term 2014
Solutions for Homework 4
1. Use the technique from Section 6.1 in the book (i.e. constructing an
NFA for a given regular set by following the recursive denition of
the regular set) to build the state di
Solutions Manual
for
Languages and Machines:
An Introduction to the Theory of
Computer Science
Third Edition
Thomas A. Sudkamp
Preface
This solution manual was written to accompany the third edition of Languages and Machines: An
Introduction to the Theory
CS 3133 Foundations of Computer Science
C term 2015
Solutions for Homework 3
1. Exercise 1 on page 184.
Solution:
(a) The state diagram of M is
q
a
b
a
b
a
q
1
0
q
2
b
(b)
i)
iii)
[q0 , abaa]
[q0 , baa]
[q1 , aa]
[q2 , a]
[q2 , ]
ii)
[q0 , bababa]
[q1 , a
CS 3133 Foundations of Computer Science
C term 2016
Homework 3, due Monday, February 8
READING: Chapters 4, 5, 6.
1. Exercise 1 on page 184. (20 points)
2. Exercise 12 on page 185. (20 points)
3. Design a DFA that accepts the language consisting of the se
CS 3133 Foundations of Computer Science, C term 2016
Homework 2, due Monday, February 1
READING: Chapters 3, 4, 5, 18.
1. Exercise 2 on page 97. (15 points)
2. Exercise 4 on page 98. (20 points)
3. Exercise 11 on page 99. (15 points)
4. Show by induction
CS 3133 Foundations of Computer Science
C term 2016
Homework 1, due Monday, January 25
Most homeworks will be worth 100 points; consider the point value in
determining how much time you spend on each question. Homeworks must
be legible and stapled, with w
CS3133
FINAL EXAM
Name_
Date: October 17, 2013
All documentation permitted
1. (30 points) Is membership in the following languages decidable? Justify your answers.
a DFAs M  L ( M ) is infinite
cfw_
That is, given a DFA M, is there an algorithm to decid
CS3133
MIDTERM EXAM
Name_
Date: September 23, 2013
All nonelectronic documentation permitted
1. (20 points) Let L be the set of all binary strings which don't contain an 010 and do
contain an even number of 1s. So 01010 L (because it contains an 010), and
CS 3133 Foundations of Computer Science
C term 2015
Homework 3, due Monday, February 9
READING: Chapters 4, 5, 6.
1. Exercise 1 on page 184. (20 points)
2. Exercise 11 on page 185. (20 points)
3. Design a DFA that accepts the language consisting of the se
CS 3133 Foundations of Computer Science
C term 2015
(Last) Homework 5, due Monday, March 2
READING: Chapters 7, 8, 14, 15, 16.
1. Exercise 17.b. on page 249. (20 points)
2. Let M be the Turing machine dened by
q0
q1
q2
B
a
b
c
(q0 , B, R) (q0 , a, R) (q0
CS 3133 Foundations of Computer Science, C term 2015
Homework 2, due Monday, February 2
READING: Chapters 3, 4, 5, 18.
1. Exercise 2 on page 97. (15 points)
2. Exercise 4 on page 98. (20 points)
3. Exercise 7 on page 98. (15 points)
4. Show by induction t
CS 3133 Foundations of Computer Science
C term 2015
Homework 1, due Monday, January 26
Most homeworks will be worth 100 points; consider the point value in
determining how much time you spend on each question. Homeworks must
be legible and stapled, with w
CS 3133 Foundations of Computer Science
C term 2015
Homework 4, due Monday, February 23
READING: Chapters 6, 7.
1. Exercise 3 on page 217. (There is an error in the book, it should say:
The language of the DFA M in Example 5.3.7 consists of.) (20 points)
CS 3133 Foundations of Computer Science
C term 2015
Solutions for Homework 4
1. Exercise 3 on page 217. (There is an error in the book, it should say:
The language of the DFA M in Example 5.3.7 consists of.)
Solution:
After deleting the state [oa , eb ] w
CS 3133
Exam 4 study guide

CHANGES Feb 23:
 feel free to skip sections 28.3 and 28.4, there will not be
any exam 4 questions on that material
 you can skip Exercise 179 (that uses closure properties)
 the True/False questions will be VERY restr
CS 3133
Exam 3 study guide
* Reading in the lecture notes:
Chapters 11, 12, 16, 17, 18
* Exercises
 in Chapter 15, the sections titled "From Automata to Regular
Expressions" and "Minimizing DFA"
 in Chapter 24, the sections titled "Basics", "Ambiguity
CS 3133 Foundations of Computer Science
C term 2015
Solutions for Homework 1
1. Exercise 22 on page 60.
Solution:
The set of strings over cfw_a, b that contain the substring aa at least
twice is represented by
(a b) aa(a b) aa(a b)
(a b) aaa(a b)
We have
Foundations of Computer Science
CS 3133
Pi Fisher
C Term 2015
1
Formal Languages
The alphabet is the set of symbols (a, b, c, . . . ) that make up strings in our
language. is the set of all possible strings using . A formal language is a set
L . The empty
Programming Languages and Lambda Calculi
(Utah CS7520 Version)
Matthias Felleisen
Matthew Flatt
Draft: March 8, 2006
Copyright c 1989, 2003 Felleisen, Flatt
2
Contents
I
Models of Languages
7
Chapter 1: Computing with Text
1.1 Dening Sets . . . . . . . .
CS 3133 Foundations of Computer Science
C term 2016
Solutions for the Midterm Exam
1. Give a regular expression that represents the set of strings over =
cfw_a, b that do not contain the substring aa.
Solution:
b (ab+ ) ( a)
(20 points)
2. Consider the fo
15
15
15.1
EXERCISES ON REGULAR LANGUAGES
Exercises on Regular Languages
Finite Automata
Exercise 42. For each of the following languages, make an FA recognizing it. If you make
a DFA directly, fine. If you make an NFA at first, thats fine too. Once youve