



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




The total points are as follows: The type A points on this exam sum to 13. The type B points on this exam sum to 16. The type C points on this exam sum to 13. The type D points on this exam sum to 13.
bool main(int n) { if (n < 3 ) return(no); int i = 7; while ( i != n ) i--; return(yes); }
(a) What is Y (P )? [2, A]
(b) What is N (P )? [2, A]
(c) What is I(P )? [2, A]
(d) Is Y (P ) solvable? Explain why or why not. [2,C]
(a) What is {a, ab, aaa, aab} − {a, b, ba, baa}? [1, A]
(b) Express the fact that RE is closed under the set difference operation as a first-order logic statement or an if-then statement. [2, A]
(c) Fill in the blanks in the following outline of a generic element proof that RE is closed under the set difference operation. [2, B]
(d) Consider the following candidate program P ′: bool main(string z){ if (P 1 (z) && !P 2 (z)) return (yes); else return (no); } bool P 1 (string z) { /* details hidden / } bool P 2 (string z) { / details hidden */ } i. Identify the set of strings P ′^ processes incorrectly. [1,D]
ii. State what P ′^ should do on this set of strings. [1,D]
iii. State what P ′^ actually does on this set of strings. [1,D]
Assume PF is a program that solves F AIL. Consider the following incomplete program D.
bool main(unsigned int y) { program P = generate(y); if (PF (P, y)) Action A; else Action B; } program generate(unsigned int y); bool PF (program P, unsigned int y);
(a) What does it mean if PF (P, y) evaluates to true? [1,B]
(b) What does it mean if PF (P, y) evaluates to false? [1,B]
(c) In order to complete program D, what actions would be appropriate? Circle all that apply. [2, D] Action A: Accept, Reject, Loop, Crash Action B: Accept, Reject, Loop, Crash (d) Explain your answer to part (c). [2, D]
Justify your answer for the last problem on the list. [6,D]
(a) Input: A program P that takes as input a string over {a, b} Yes/No Question: Is Y (P ) infinite?
(b) Input: A program P that takes as input a string over {a, b} Yes/No Question: Is I(P ) infinite?
(c) Input: A program P that takes as input a string over {a, b} Yes/No Question: Is Y (P ) solvable?
(d) Input: A program P that takes as input a string over {a, b} Yes/No Question: Is N (P ) = {}?
(a) Every solvable problem is also half-solvable. (b) RE is closed under the set complement operation. (c) Program behavior problems are generally solvable. (d) It is ok for a program that half-solves a language L to loop on a string x ∈ L. (e) If L 1 is half-solvable and L 2 is finite, then L 1 ∩ L 2 is solvable.
bool main(string z){ Q 1 (5); if (z[0] == b) return(yes); else return(no); } bool Q 1 (int x) {/* details not provided */}
(a) State our modified version of Church’s Thesis. [2, A]
(b) Describe the significance of our modified version of Church’s Thesis. [2, C]