1. (Due January 29 for extra credit, due February 3 for regular credit) Prove that the function computing the sum
2. (Due February 3) Prove that if P(n), Q(n), R(n), f(n), g(n), and h(n), are all primitive recursive, then the function described as
Comment. Here, !P and !Q, as usual in Java, mean negation.
3. (Due February 3) Prove, from scratch -- i.e., using only the definition of the primitive recursive function (and not using any results that we had in class without proving them) -- that the function a / (a % b) is primitive recursive.
4. (Due February 3) Write a Java program corresponding to the following primitive recursive function F = σ(σ(PR(σ(0), sum(π22, π21)))). For this function F, what is the value of F(2)?
5. (Due February 5) Let us define a function to be (A+n)-primitive recursive if it can be obtained from 0, σ, πki, and a function A(n) + n (where A(n) is Ackermann's function) by using composition and primitive recursion. Prove that there exists a computable function which is not (A+n)-primitive recursive. Hint: we need a minor modification of the first (detailed) proof that there exists a computable function which is not primitive recursive.
6. (Due February 10) Show that the following function f(a, b) is μ-recursive: f(a, b) = !a && !b when each of the two inputs a and b is either equal to 0 or equal to 1, and undefined for other pairs (a, b).
7. (Due February 10) Prove that the following function is mu-recursive:
int j = a;
while(!(j + b <= c))
{j++;}
8. (for extra credit, Due February 10) Describe integer division a / b in terms of μ-recursion, similarly to how in the lecture, we describe subtraction in terms of μ-recursion.
9. (Due February 12 for extra credit, due February 17 for regular credit) Design a Turing machine that computes a function f(n) which is equal to n − 2 if n > 2 and to 0 if not; assume that the input n is given in unary code.
10. (Due February 24) In class, we designed a Turing machine for computing π21. Use this design as a sample to design a Turing machine for computing π41 for tuples of unary numbers. Trace, step-by-step, on an example, how your Turing machine works. For example, you can take as input the triple (2, 1, 1, 3).
Reminder: The Turing machine for computing π21 for tuples of unary numbers is based on the following idea:
11. (Due February 24) In class, we designed a Turing machine for computing π22. Use this design as a sample to design a Turing machine for computing π42 for tuples of unary numbers. Trace, step-by-step, on an example, how your Turing machine works. For example, you can take as input the tuple (2,1,1,1). Also, check also that your code works when one of the numbers is 0, especially when the third number is 0.
Reminder: The Turing machine for computing π22 for tuples of unary numbers is based on the following idea:
This Turing machine has the following main rules:
12. (Due February 24) In class, we described a Turing machine that computes g(n) = n + 1 for unary numbers. In Homework 9, you designed a Turing machine that computes a function f(n) which is equal to n − 2 when n > 2 and to 0 otherwise -- also for the case of unary numbers.
In class, we described the general algorithm for designing a Turing machine that computes the composition of two functions. The assignment is to use this general algorithm to design a Turing machine that computes the composition f(g(n)) for unary n. Trace, step-by-step, on an example, how your Turing machine works. For example, you can take as input n = 1.
Reminder: The Turing machine for computing g(n) = n + 1 for a unary input n is based on the following idea:
13. (Due February 24) Similarly to a Turing machine that we had in class, that copies a number, design a Turing machine that copies words consisting of letters a and b. Test it on the example of a word ab. The result should be ab_ab, with a blank space in between. Hint: instead of marking 1s, mark both a's and b's; instead of the state carry1in1st, we can now have two different states: carryain1st and carrybin1st.
14. (Due February 24) Sketch an example of a Turing machine for implementing primitive recursion (i.e., a for-loop), the way we did it in class, on the example of the following simple for-loop
v = a;
for(int i = 1; i <= b; i++)
{v = v + i;}
No details are required, but any details will give you extra
credit.15. (Due February 24) Sketch an example of a Turing machine for implementing mu-recursion, the way we did it in class, on the example of a function μm.(m > a). No details are required, but any details will give you extra credit.
16. (Due March 3) Use the impossibility of zero-checker (that we proved in class) to prove that no algorithm is possible that, given a program p that always halts, checks whether this program always computes n2 − n.
22. (Due March 3) Give:
23. (Due March 5) To solve quartic equations a * y4 + b * y2 + c = 0, a natural idea is to introduce a new variable z = y2 for which we will have a quadratic equation -- an equation that we know how to solve. Describe the resulting reduction in general terms: what is C(x, y), what is C'(x', y'), what is U1, U2, and U3.
17. (Due March 17) Write and test a method that simulates a general Turing machine. Your program should enable the computer to simulate any given Turing machine for accepting-rejecting and then to simulate, for any given word, step-by-step, how this Turing machine decides whether this word is accepted or not.
The input to this method should include:
Your program should simulate the work of the Turing machine step-by-step. Return the printout of the method, the printout of the program that you used to test this method, and the printout of the result of this testing. Feel free to use Java, C, C+++, Fortran, or any programming language in which the code is understandable.
Example: A Turing machine for checking whether a binary string is even (i.e., ends with 0) has the following rules:
18-20. (Due March 31) Suppose that A, B are r.e. sets.
18. If a number n appears in the A-generating algorithm at moment 3, when will this number appear in the algorithm generating all elements of the union A U B?
19. If a number n appears in the A-generating algorithm at moment 3 and in the B-generating algorithm at moment 5, when will this number appear in the algorithm generating all elements of the intersection of A and B?
20. If a number n appears in the A-generating algorithm at moment 2, and the complement −A is also r.e., when will the deciding algorithm tell us that n is an element of the set A?
21. (Due March 31) Let us consider cases when the sets A and B are decidable and the complement to the set C is r.e. Give four examples of such cases:
34. (Due April 16) Use the general algorithm to come up with DNF form and CNF form of the formula 0.4 * x1 + 0.6 * x2 ≥ 0.5 * x3.
35. (Due April 16) Similar to what we did in the class, illustrate the general algorithm of reducing NP problems to satisfiability on the example of the following problem:
24. (Due April 21) On the example of the formula (~a \/ b \/ c \/ ~d) & (a \/ ~b \/ ~c), show how checking its satisfiability can be reduced to checking satisfiability of a 3-CNF formula.
25. (Due April 21) On the example of the formula (~a \/ b \/ ~c) & (a \/ ~b), show how checking its satisfiability can be reduced to coloring a graph in 3 colors.
26. (Due April 21) On the example of the formula (~a \/ b \/ ~c) & (a \/ ~b), show how checking its satisfiability can be reduced to an instance of the clique problem.
27. (Due April 23) On the example of the formula (~a \/ b \/ ~c) & (a \/ ~b), show how checking its satisfiability can be reduced to an instance of the subset sum problem (i.e., the problem of exact change.
28. (Due April 23) On the example of the formula (~a \/ b \/ ~c) & (a \/ ~b), show how checking its satisfiability can be reduced to an instance of the interval computation problem.
29. (Due April 23) Show how to compute the "and" of 15 boolean values in parallel if we have unlimited number of processors. How many processors do we need and how much time will the computation take? Why do we need parallel processing in the first place?
30. (Due April 23) If we take into account communication time, how fast can you compute the sum 1 + 1/2 + ... + 1/n in parallel? Hint: See Section 2 of the paper with Dara Morgenstein on the class website.
31. (Due April 28) Suppose that we have a probabilistic algorithm that gives a correct answer 3/4 of the time. How many times do we need to repeat this algorithm to make sure that the probability of a false answer does not exceed 5%? Explain your answer. Give an example of a probabilistic algorithm. Why do we need probabilistic algorithms in the first place?
32. (Due April 28) Pick an example of an Ali-Baba problem, and explain, step by step, what solution two greedy algorithms will produce for this example.
33. (Due April 28) Use the variable-elimination algorithm for
checking satisfiability of 2-SAT formulas that we had in class to
find the values that satisfy the following formula:
(a \/ b) &
(~a \/ b) & (~a \/ ~b) & (a
\/ ~c) & (~a \/ ~c) & (b \/ ~c).
39. (Due April 28) What can you say about the Kolmogorov complexity of the string 100100... in which the sequence 100 is repeated 2025 times?
36. (Due April 30) On the example of the function f(x) = ~x, trace, step by step, how Deutsch-Josza algorithm will conclude that f(0) ≠ f(1) while applying f only once.
37. (Due May 7) What class of polynomial hierarchy contains Π2PΣ2P? Explain your answer.
38. (Due May 7) Describe, in detail, at least two different schemes that use serious but still hypothetical physical processes to solve NP-complete problems in polynomial time.