CS 350 - Homework Solutions Chapter 2
Ex 2.1 (a) E ) T
)F )a
E T
F
a
(b) E ) E + T ) T + T
)F +T )F +F )a+F )a+a
E E T
T F F
a
+
a
(c) E ) E + T ) E + T + T ) T + T + T ) F + T + T )F +F +T )F +F +F )a+F +F )a+a+F )a+a+a
1
E E T
E T
T
F
F
F
a
+a
+
a
(d) E
Recommended problems 10/18/2005 CSCI 2670 4.6 Assume B is countable and that f:NB is a functional correspondence. Let fi(j) denote the ith symbol in f(j). Consider the string s whose ith element differs from fi(i) i.e. if fi(i) = 0, then the ith symbol in
CSCI 2670 Intro. to Theory of Comp. Quiz 8 11/3/05 Name: _
In this quiz, you will prove the following language is undecidable FINITETM = cfw_<M> | M is a TM and L(M) is finite. The quiz has 4 questions. If you skip a question, you can answer the next ques
CSCI 2670 Intro. to Theory of Comp. Quiz 6 10/12/2005 Name: _ (1) (5 points) In class and in the text, we used the following Turing machine E to enumerate a language accepted by Turing machine M. First, we determined a way of listing all strings in * i.e.
CSCI 2670 Intro. to Theory of Comp. Quiz 4 9/20/05 Name: _solution_
(1)
(4 points) Write a regular expression R such that L(R) = cfw_w | w cfw_a,b* and w has an even number of as. b*( ab*ab*)*
(2)
(3 points) What are the properties of x, y, and z in the p
CSCI 2670 Intro. to Theory of Comp. Quiz 3 9/7/05
Name: _Solution_
(1)
(4 points) Draw a five-state NFA that accepts all strings of 0s and 1s with the substring 0011.
(2)
(3 points) What are the regular operators (i.e., the operators that are used to comb
CSCI 2670 Quiz 2 Solution September 1, 2005
(1) Consider the DFA drawn below. The alphabet of this DFA is cfw_a, b, c.
a. (2 points) Which of the following strings does this DFA accept? (correct answers in bold) aabba aabbccc acccc bbccc b. (2 points) Inf
CSCI 2670 Intro. to Theory of Comp. Quiz 1 8/24/05
Name: _
(1)
(4 points) What binary relation is represented by the following graph? 1 2
3
4
cfw_(1,2), (1,3), (3,2), (3, 4)
(2)
(3 points) Let A = cfw_1, 2, 3, 4, 5. Give three elements of P(A), the power
CSCI 2670 November 9, 2005 HW 9 5.7 If A is Turing-recognizable and A m , then (by Theorem 5.28) is Turingrecognizable i.e., A is co-Turing-recognizable. Therefore, (by Theorem 4.22) A is decidable since A is both Turing-recognizable and co-Turing-recogni
CSCI 2670 HW 8 11/2/05 Solutions 1. Show T = cfw_<M> | M is a TM with L(M)R = L(M) is an undecidable language. Proof: Assume T is decidable and let D be a decider for T. Consider the following Turing machine S: S = On input <M,w>, where M is a Turing mach
CSCI 2670 Hw 7 4.4.1 Consider the following Turing machine M = on input <A>, where A is a DFA 1. Create a DFA B such that L(B) = * 2. Submit <A,B> to the decider for EQDFA 3. If it accepts, accept 4. If it reject, reject. M is clearly a decider since step
Homework 6 Solution CSCI 2670 October 11, 2005 3.7 The problem is with step 2. The Turing machine has to evaluate the polynomial at every possible combination of integer values for x1, x2, , xk. Since there are an infinite number of possibilities, the mac
CSCI 2670 Fall 2005 HW 4 September 20, 2005 Use the pumping lemma to prove A=cfw_wwR|wcfw_a,b* is not regular. Proof: Assume A is regular. Then A has an associated pumping length p such that any string s in A with |s|p can be written as s = xyz such that
CSCI 2670 Fall 2005 HW 3 September 13, 2005
1.7d
1.7h 1.16b Below is the state transition table. The states in the first column that are highlighted are accept states. The start state will be cfw_q1, q2 since this is the set of states that can be reached
CSCI 2670 Fall 2005 HW 1 September 6, 2005 1.7b
1.8a
1.10a
1.15 The construction described in this problem is similar to the construction in the proof of Theorem 1.49. The difference is that the construction in the problem uses the original start state an
CSCI 2670 Fall 2005 HW 1 August 30, 2005 0.3 a) no b) yes c) cfw_x,y,z d) cfw_x,y e) cfw_(x,x),(x,y),(y,x),(y,y),(z,x),(z,y) f) cfw_,cfw_x,cfw_y,cfw_x,y
0.7 a) cfw_(x,y) | x,y are stings of 0s and 1s the same number of 0s OR 1s b) cfw_(x,y) | x y c)
0.12
CSCI 2670 Introduction to Theory of Computing
August 23, 2005
August 23, 2005
Agenda
Last class
Reviewed syllabus Reviewed material in Chapter 0 of Sipser Assigned pages Chapter 0 of Sipser
Questions?
This class
Goal for the week
Section 1.1
Read S
CSCI 2670 Introduction to Theory of Computing
September 22, 2005
Agenda
Yesterday
Pushdown automata
Today
Equivalence of pushdown automata and CFGs Pumping lemma for CFGs
September 22, 2005
Announcements
Matrix Reloaded tonight!
6:30 in Boyd 328
Fr
Assignment 4 Answer Key 1.7.b
1.7.c
1.9.b
1.10a
1.16a
1.19a
1.18a 1.18b 1.18c 1.18d 1.18e 1.31
1 (0 U 1)* 0 0* 1 0* 1 0* 1 0* (10*)* (0 U 1)* 0101 (0 U 1)* (0 U 1) (0 U 1) 0 (0 U 1)* ( (0 U (10 U 11) (0 U 1)(0 U 1)* )
Since A is regular, we can assume the
CSCI 2670 Introduction to Theory of Computing
September21,2005
Agenda
Yesterday Today
Pushdownautomata Quiz Moreonpushdownautomata PumpinglemmaforCFGs
September 23, 2004
2
Finite automata and PDA schematics
FA Statecontrol
aabb
PDA
Statecontrol
aabb x y
CSCI 2670 Introduction to Theory of Computing
September 21, 2005
Agenda
Yesterday
Pushdown automata
Today
Quiz More on pushdown automata Pumping lemma for CFGs
September 23, 2004
2
Finite automata and PDA schematics
FA State control State control
x y
Assignment 1 Answer Key Assume the natural numbers include 0, you were not penalized if you assumed otherwise. 1) 0, 3 or 6 would be acceptable answers 2) cfw_, cfw_0, cfw_0, 1, 2, 3, 4 or C would all be acceptable answers 3) This is actually the same as
CSCI 2670 Introduction to Theory of Computing
September 20, 2005
Agenda
Last week
Context-free grammars
Examples, definition, strategies for building
This week
More on CFGs
Chomsky normal form, Pushdown automata, pumping lemma for CFGs
Announcement
CSCI 2670 Introduction to Theory of Computing
September 15, 2005
Agenda
Yesterday
Introduce context-free grammars
Today
No quiz!
Quiz postponed until Monday
Regular expressions, pumping lemma, CFGs
Build CFGs
Context-free grammar definition
A cont